I am stuck on a question concerning right triangles. I will list my approach out below:
Question
Consider a right-angled triangle with hypothenuse (i.e. diagonal side) of length 2 and draw a vertical line from the midpoint of the hypothenuse to the corresponding cathetus (i.e. the bottom side). You should get a picture as drawn below. What is the maximal total length of all lines (including the hypothenuse)?
Reasoning

Let's say the legs of the larger triangle are $2a$ and $2b.$
Our objective is $L = 2a + 3b + 2$
Constrained by $a^2 + b^2 = 1$
Now the way that I like to do these is to take the derivative of both functions, setting the derivative of the objective function equal to $0.$ This is not the way it is usually taught.
$2\ da + 3 \ db = 0\\ 2a\ da + 2b \ db = 0$
Substituting from one equation into the other.
$(-3a + 2b) db = 0$
$db$ may be very small but it is not zero.
$2b = 3a$
And substitute this into the constraint.
$a^2 + (\frac {3a}{2})^2 = 1\\ \frac {13}{4} a^2 = 1\\ a = \sqrt {\frac {4}{13}}\\ b = \sqrt {\frac {9}{13}}\\ L = \frac {13}{\sqrt {13}} + 2 = \frac {\sqrt {13}}{13} + 2$
The more conventional thing to do is to substitute based on the constraint before differentiating.
$a^2 + b^2 = 1\\ a = \sqrt {1-b^2}\\ L = 2\sqrt {1-b^2} + 3 b$
Differentiate, set the derivative equal to $0$ and solve for $b.$
However, after working this out, I see a 3rd possibility. We can say
$a = \cos \theta\\ b = \sin\theta\\ L = 2\cos\theta + 3\sin\theta + 2$
Now there is no constraint to deal with.
$-2\sin\theta + 3\cos\theta = 0\\ \theta = \arctan \frac {3}{2}$