# How to build a trapezoid

Build a trapezoid knowing its diagonals, the angle between them, and, also, the sum of $2$ adiacent sides.

I appreciate your time and help!

• Do you need an analytical solution? Or is it acceptable to use a numerical optimisation technique (like gradient descent)? – Dan Jan 8 '14 at 7:15

Given the lengths $\ell_1, \ell_2$ of two diagonals and the angle $\alpha$ between them, let $2a$ be the required sum of lengths of two adjacent sides.

1. Construct three helper points $A, B, C$ such that $AB = \ell_1, AC = \ell_2$ and $\measuredangle BAC = \alpha$.
($AB$ and $AC$ are the two blue line segments in diagram below)
2. Construct an ellipse having $A, B$ as foci with semi-major axis $a$.
(The red ellipse in diagram below)
3. Start from the two line segments $AB$ and $AC$, construct parallelogram $ABEC$ and let the line $AE$ intersect the ellipse at $F$.
4. Start from the line segments $AC$ and $CF$, construct parallelogram $AGFC$.

Take $AB$ and $GF$ as the two desired diagonal. The quadrilateral $AGBF$ will be a trapezoid one seek. To see this.

• By construction, $|AB| = \ell_1$. Since $AGFC$ is a parallelogram, $|GF| = |AC| = \ell_2$ and angle between $AB$ and $GF$ is the angle $\measuredangle BAC = \alpha$.
• Since $F$ lies on the ellipse having $A$, $B$ as foci. $|AF| + |BF| = 2a$.
• Since $ABEC$ and $AGFC$ are parallelograms, $GBEF$ is a parallelogram too. As a result, $GB \parallel FE \parallel AF$.

• Thanks, achille hui. +1! Could you take a look at my Geometrical construction problem (2) ( and (1) )? Many thanks! – Akhtubir Jan 8 '14 at 16:07
• @Akhtubir For (1), if I understand the question correctly. following André Nicolas's hint there will give you a simple and straight forward construction. For (2), the question is not clear, you need to clarify the question first. – achille hui Jan 8 '14 at 16:18
• Could you tell, with respect, what is not clear? I copied the problem context from a book. I edit it right now. – Akhtubir Jan 8 '14 at 16:30

Problem

Given $x+y$, $d_1$, $d_2$ and $\alpha$, construct trapezoid $ABCD$ as sketched in Fig.1.

Solution

See Fig.2.

1. Mark an arbitrary point $A$

2. From $A$ draw an arbitrary ray $r$

3. Mark a point $C$ on r, such that $AC=d_1$

4. From $C$ draw a ray $s$, such that the measure of the angle between $r$ and $s$ is $\alpha$

5. Mark $E$ on $s$, such that $CE = d_2$

6. Draw the line segment $AE$

7. Draw a line $t$ $(t \parallel AE)$ such that $C \in t$

8. Mark $A'$ on $t$ such that $A'C = x+y$

9. Draw the perpendicular bisector $u$ of $AA'$(*)

10. Mark point $B$, such that $B=u \cap t$

11. Mark point $D$ on $AE$ such that $BD =d_2$

(*) Note in Fig.1 that $AB=A'B$, hence B is a point of the perpendicular bisector of $AA'$

• +1 Cool construction. However, I think you should elaborate a little bit more about Step 9. It takes me a while to figure out what it does and why it works. – achille hui Jan 9 '14 at 0:51
• @achillehui I've inserted a note. I hope it's more comprehensible now. – RicardoCruz Jan 9 '14 at 1:22

My suggestion is to use a numerical optimization technique (such as fmincon in Matlab or the solver in Excel, i.e. techniques such as Nelder-Mead optimization etc) as follows:

Let's define some variables:

$L_{1}$ and $L_{2}$ are the lengths of the diagonals. $k$ is the sum of the 2 adjacent sides. $(x,y)$ is the coordinate vector of the corner between the two adjacent sides. $\alpha$ is the angle between the diagonals (which will be the angle of the second diagonal with the x-axis in the anticlockwise, i.e. negative, direction)

Start with one of the diagonals placed on the x-axis. This diagonal is now the vector $(L_{1},0)$. I will refer to this as the base diagonal. What we are going to do is construct a triangle using this vector as the bottom line of the triangle by randomly choosing the third point to be $(x,y)$ subject to the constraint that the two sides sum to $k$. Once we have chosen this point, using the length and angle of diagonal information we can construct only one quadrilateral. We can then define a error as the angle between two opposite sides (as they must be parallel to form a trapezoid) which we can run through an optimization algorithm to solve for 0.

So we have some constraints for $(x,y)$:

The adjacent sides must sum to $k$. The first side is simply the vector $(x,y)$. The second is the line form $(x,y)$ to $(L_{1},0)$. So this gives us the constraint

$\sqrt{x^2 + y^2} + \sqrt{(L_{1} - x)^2 + y^2} = k$

The angle between the two diagonals for also creates constraints. Think of the diagonals intersecting at either end of our base diagonal, i.e. the red dashed lines in the figure. $(x,y)$ must fall between these two lines. For example the left hand boundary means that the angle of $(x,y)$ must be smaller than $180^\circ - \alpha$ or $\tan(y/x) \le \pi-\alpha$. I'll leave the other constraint for you. The fourth and final constraint is that $x$ must be strictly positive.

Next we need to find our error ($\epsilon^2$):

This is the angle between the two sides we want to be parallel. I'm going to make these the side opposite the origin, i.e. the line from $(x,y)$ to $(L_{1},0)$, and then the side starting at $(0,0)$ and ending at the fourth corner which we will call $(x_{1}, y_{1})$. To find this angle we can take a dot product of the two lines i.e.

$\cos{\epsilon}=(x-L_{1},y)\cdot(x_{1},y_{1})$

So in order to solve for $\epsilon$ we need first to find $(x_{1},y_{1})$. To do this we need to construct the second diagonal which we know goes from $(x,y)$ to $(x_{1},y_{1})$, has a length $L_{2}$ and an angle of $-\alpha$. By taking dot products again, I get that

$\cos{\alpha}=\dfrac{(x_{1}-x,y_{1}-y)\cdot(L,0)}{L_{1}\times L_{2}}$

$\therefore x_{1}=x+L_{2}\cos{\alpha}$.

We can find $y_{1}$ now because $(x_{1}-x)^2+(y_{1}-y)^2=L_{2}^2$

Thus we can solve for $\epsilon^2$.

This is now everything we need to feed to a Nealder-Mead or Levenberg-Marquardt type optimizer to find the $(x,y)$ that will make the two sides parallel and thus find a trapezoid subject to all your conditions.

• Dan, I needed a geometrical - construction solution. But I appreciate your suggestion, I noted it. Many thanks! – Akhtubir Jan 8 '14 at 16:06