Construction of a square ABCD There are two nonparallel lines $p,q$ and point $A$, $A \notin p,q $ which lies between lines $p,q$. Construct a square ABCD such that $B \in p$ and $D \in q$. In special case in which $45°$ is angle between $p,q$ it's simple to construct it. But I need to find solution for any general angle and position of the point $A$ and to make discussion about the number of solutions (depending on position of point $A$). I don't know how to start. Thanks for any help.
 A: Let $V$ be the intersection of lines $p$, $q$ and define: $\beta=\angle AVB$, $\delta=\angle AVD$, $\phi=\angle VAB$, $\theta=\angle VAD$. Notice that we can have two solutions: one with $\phi+\theta=\pi/2$ and the other with $\phi+\theta=3\pi/2$ (this second solution corresponds to square $AB'C'D'$ in the picture below).
By the sine law applied to triangles $VAB$ and $VAD$ we have $AB/AV=\sin\beta/\sin(\phi+\beta)$ and $AD/AV=\sin\delta/\sin(\theta+\delta)$. By combining these and eliminating $\theta$ we obtain
$$
{\sin\beta\over\sin(\phi+\beta)}=\pm{\sin\delta\over\cos(\phi+\delta)},
$$
where the sign of the right hand side depends on which solution we choose. It is easy to solve this for $\phi$:
$$
\tan\phi={\sin\beta\over\sin\delta}
{\sin\delta\mp\cos\delta\over\sin\beta\mp\cos\beta}.
$$

There are no solutions when $\phi+\beta=\pi$. I leave to you finding the values of $\beta$ and $\delta$ which lead to this case.
A: I have an idea, but I don't know how it  will sound for you, as it involves solving system of  unknowns with nonlinear equations , and I don't know if you are familiar with or not.
Considering two straight lines  $(p) \,  \, y=ax+b$   and  $(q) \, \,y=a'x+b'$.  Let $A=(\alpha, \beta )$, and let  $ B=(x_1,y_1)$  and $ D=(x_2,y_2)$. As $ABCD$ is a square with $B$ in $(p)$ and  $D$ in $(q)$ we get the following:


*

*$B$ in $(p) \Rightarrow  y_1=ax_1+b $

*$D$ in $(q) \Rightarrow  y_2=a'x_2+b'$

*$AB.AD=0$ (The dort product is zero since $ \hat{(BAD)}=0$)

*$ \bar{BD}=\sqrt{2} \, \,\bar{AD}$ ( since  $ADB $ is a right isosceles triangle)  where $\bar{BD}^2=(x_2-x_1)^2+(y_2-y_1)^2 $


Substituting A,B, and D with their coordinates , we end up with four equations with four unknowns ($ x_1,x_2,y_1,\text{ and } y_2$). Then substituting  $y_1$  and  $y_2$ from  (1) and (2), in  (3) and (4) we end this time with two  non linear equations with just two unknowns.
Note that  (4) can be replaced by $ \bar{AB}=\bar{AD}$. 
