optimization problem: need help getting constraint

So I have N lines that are specified by a y-intercept and an angle, q. The constraint is that all lines must intersect. Given this constraint, I can come up with these equations:

Y = tan(q(1))X + y(1)

Y = tan(q(2))X + y(2)

...

The constraint should not contain any Y or X variables. I can easily get the constraint by hand if N = 3 or 4 but if N is greater than 4, I have some trouble. With 3 and 4 lines, when I try and solve for X, I get 2 equations and I can then set them equal to each other and get the constraint. When I have more than 4 lines, the number of equations I get that equal X is greater than 2 so I dont know how to condense that into one constraint. I need a systematic way of condensing it down that will work for any number of lines.

Re: optimization problem: need help getting constraint

Do the lines should intersect in pairs or there must be one common point on all of them?

For the first option state that all qi's are different.For the second ,write the equation of the lines that pass through a fixed point (x0,y0).

Re: optimization problem: need help getting constraint

one common point. In the equations I gave, the common point would be (X,Y). As a bigger picture, I do not know these angles but I know estimates of these angles. With just estimate angles, the lines will never intersect. What I want to do is find all the optimized angles that cause all the lines to intersect while minimizing the distance between the angles.

I know I can write the equations so they pass through a single fixed point, I am just having trouble coming up with a constraint equation to then use to optimize a function.