# Divide into 2 isosceles triangles

## Python 3.8 (pre-release), ~~123~~ 129 bytes

```
g=lambda*p:[[180-2*x,x]for x in p]
f=lambda a,b:((c:=180-a-b)==90or c>45>2in{a/b,b/a})*g(a,b)or(c/3in{a,b})*g(c/3,c/3*2)or f(b,c)
```

Try it online!

A function that takes in 2 angles, and returns the 2 isosceles triangles. If the given triangle cannot be divided, the function loops forever.

## 05AB1E, ~~39~~ 38 bytes

```
OƵΔαª©90KD®Qiʒ45‹®y23S*åà*}ßx‚}ε90α·y‚
```

Input as a pair of integers; output as a pair of pairs of integers.

Try it online or verify all test cases.

**Explanation:**

```
O # Take the sum of the (implicit) input-pair of angles
ƵΔα # Get the absolute difference with (compressed) 180
ª # Append that third angle to the (implicit) input-pair
© # Store it in variable `®` (without popping)
90K # Remove 90 from the triplet of angles
D # Duplicate it
®Qi # If it's still equal to `®` (thus none were 90):
ʒ # Filter the triplet by:
45‹ # Check that the angle is smaller than 45
* # AND
y2 S* # Check if the angle multiplied by 2
3S* à # or multiplied by 3
® å # is in the triplet of angles `®`
}ß # After the filter: pop and push the minimum of the remaining angles
x # Double it (without popping)
‚ # Pair the non-doubled and doubled values together
}ε # After the if statement: map the angles in the pair to:
90α # Get the absolute difference with 90
· # Double it
y‚ # And pair it with the non-mapped angle
# (after which the resulting pair of pairs is output implicitly)
```

See this 05AB1E tip of mine (section *How to compress large integers?*) to understand why `ƵΔ`

is `180`

.

## APL (Dyalog Unicode), 47 bytes

```
(⊢,⍨¨2×90-⊢)∘{90∊⍵:⍵~90⋄1 2×⌊/⍵∩∊⍵÷⊂2 3},,180-+
```

Try it online!

A tacit function that takes two angles as left and right arguments.

Uses the information found by Neil, modified to take care of xnor's test case:

A triangle can be divided into 2 isosceles triangles either if

one of the anglesis < 45° and is exactly one half or one third of one of the other angles, or if one of the angles is 90°.

Now, the base angles of the result can be found as follows:

- If one of the angles is 90°, the bases are the other two angles.
- Otherwise,
`one of the angles is < 45° and is exactly one half or one third of one of the other angles`

should hold, because the input is guaranteed to have a solution. In this case, the angle satisfying the condition becomes the base for one triangle, and the other triangle's base angle is twice the angle.

### How it works: the code

```
(⊢,⍨¨2×90-⊢)∘{90∊⍵:⍵~90⋄1 2×⌊/⍵∩∊⍵÷⊂2 3},,180-+ ⍝ Left, Right: two angles
,,180-+ ⍝ Length-3 vector of three angles
{ } ⍝ Find two base angles:
90∊⍵:⍵~90⋄ ⍝ If an angle is 90, the bases are the other two
⍵∩∊⍵÷⊂2 3 ⍝ Otherwise, find the angles that are 1÷2 or 1÷3 of another
1 2×⌊/ ⍝ Take the minimum angle of that and attach its double
( )∘ ⍝ Attach apex angles to two base angles
2×90-⊢ ⍝ apex=180-2×base
⊢,⍨¨ ⍝ Attach each apex to the left of the base
```