## Let $ABCD$ be a convex quadrilateral, with diagonals $AC$ and $BD$. At each vertex the diagonal makes an angle with each of the two sides, creating eight corner angles.

For example, at vertex $A$, the two angles are $CAD$, $CAB$.

We call such a quadrilateral for which all eight corner angles have integer values when measured in degrees an “integer angled quadrilateral”. An example of an integer angled quadrilateral is a square, where all eight corner angles are $45^\circ$. Another example is given by $DAC = 20^\circ$, $BAC = 60^\circ$, $ABD = 50^\circ$, $CBD = 30^\circ$, $BCA = 40^\circ$, $DCA = 30^\circ$, $CDB = 80^\circ$, $ADB = 50^\circ$.

What is the total number of non-similar integer angled quadrilaterals?

Note: In your calculations you may assume that a calculated angle is integral if it is within a tolerance of $10^{-9}$ of an integer value.

### This problem is originated from the Project Euler problem #177. To solve such a mathematical problem, we need to use some mathematical concepts like Law of Sines and Law of Cosines.

First of all, let’s define the eight corner angles as:

1. $\alpha$, $x$, $y$, $z$ are at vertices $A$, $B$, $C$, and $D$ respectively with diagonal $AC$,

2. $\beta$, $p$, $q$, $r$ are at vertices $A$, $B$, $C$, and $D$ respectively with diagonal $BD$.

By using the Law of Sines on triangles $ABC$ and $ADC$, $\frac{sin(x)}{sin(\alpha)} = \frac{sin(r)}{sin(y+z)}$ and $\frac{sin(p)}{sin(\alpha)} = \frac{sin(z)}{sin(x+y)}$.

From these equations, we can deduce that $sin(x)sin(z)sin(y+z) = sin(p)sin(r)sin(x+y)$ and applying the product-to-sum identities, we end up with the equations in sine and cosine values of the angles only.

The same procedure is applied on triangles $ABD$ and $CBD$, and we get the equivalent equations. Now, we have two mathematical relations that define the angles of the integer-angled quadrilateral.

Now all that is left is to iterate over possible combinations of values for each angle, which ranges from 1 to 179 degrees. The restriction here is that these values have to satisfy our two equations obtained before and all angles should be integers.

For optimization purposes, instead of iterating over all combinations, we can make some deductions about possible values for some angles to reduce the number of possible combinations.

By solving this algorithm, the solution found is that there are 129 distinct non-similar integer-angled quadrilaterals. Note that two quadrilaterals are “similar” if all their corner angles are the same, in some order.

##### More Answers:

Hollow Square Laminae IIFractions and Sum of Powers of Two

Common Cathetus Right-angled Triangles