How to find the perimeter of the triangle inscribed within the square. In square $ABCD$, the length of its sides is $5$. $E, F$ are two points on $AB$ and $AD$ in
such a way so that $∠ECF = 45^\circ$, find the maximum value of the perimeter of
$ΔAEF$.
 A: The only thing you need to do is to draw $CBG$ triangle which is equivalent to $CDF$. It is easy to see the rest:

A: Firstly, since they asked for the maximum, we know that AE must be equal to AF to maximise the perimeter.  Then the figure would be symmetrical about the diagonal, so $∠ECB=∠DCF=\frac{90^o-45^o}{2}=22.5^o$.  Now $tan(22.5^o)=\frac{EB}{BC}=\frac{EB}{5}$. 
We have $EB=2.07106...$, giving us $AE=AF=5-EB=2.92893...$.  By Pythagoras' theorem, $EF=\sqrt{AE^2+AF^2}=4.1421...$.
Summing it all, $AE+AF+EF=10$.  Strangely, this is a rather nice number.  Currently working on a solution that does not require calculator.
Here is another approach which requires zero use of the calculator.  Making use of the same approach as above, $AE=AF=5-5tan(22.5^o)$, and $EF=(5-5tan(22.5^o))\sqrt{2}$.  Our total sum is $10-10tan(22.5^o)+(5-5tan(22.5^o))\sqrt{2}$.  Our goal now would be to find the mysterious $tan(22.5^o)$.
We make use of the trigonometric identity $tan(2A)=\frac{2tan(A)}{1-tan^2(A)}$.  Noting that $tan(45^o)=1$, we let $2A=45^o$.  We have, now, $1=\frac{2tan(A)}{1-tan^2(A)}$.  Solving this quadratic equation by letting $tan(A)=x$, we get $tan(22.5^o)=-1\pm\sqrt{2}$.  Knowing that $tan(22.5^o)$ is positive, it is $-1+\sqrt{2}$.
Substituting $tan(22.5^o)=-1+\sqrt{2}$ into $10-10tan(22.5^o)+(5-5tan(22.5^o))\sqrt{2}$, we get 10.
A: Big surprise: The perimeter $p$ of such a triangle is $=10$, whatever the choice of $E$.
Proof. Let the side length of the square be $1$, and put $|AE|=:x$, $|AF|=:y$.  If $\angle(ECB)=:\alpha$, $\angle(FCD)=\beta$ then
$$1=\tan(\alpha+\beta)={\tan\alpha+\tan\beta\over1-\tan\alpha\tan\beta}={2-x-y\over1-(1-x)(1-y)}\ .$$
It follows that $xy=2(x+y-2)$, which leads to
$$x^2+y^2=(x+y)^2-2xy=(x+y)^2-4(x+y)+4=(x+y-2)^2\ .$$
Since $x+y\leq2$ we therefore   obtain
$$p=x+y+\sqrt{x^2+y^2}=x+y+(2-x-y)=2\ .\qquad\square$$
