How do you derive that the inradius in a right triangle is $r=\frac{a+b-c}2$? If we have a right triangle then the inradius is equal to $$r=\frac{a+b-c}2,$$
where $c$ is the hypothenuse and $a$ and $b$ are the legs.
This formula is mentioned in various places and it can be useful both in geometric problems and in problems on Pythagorean triples.1
Question: How can one derive this formula?

1It is stated on Wikipedia (in the current revision without a reference). Some posts on this site where this equation (or something closely related) is mentioned:
If the radius of inscribed circle in a right triangle is $3 cm$ and the non-hypotenuse side is $14cm$, calculate triangle's area.,
Prove the inequality $R+r > \sqrt{2S}$,
In a Right Angled Triangle.,
How do I find the radius of the circle which touches three sides of a right angled triangle?, Is there a way to see this geometrically?, Range of inradius of a right Triangle.

I will mention that I would be able to derive this myself in some way. (And some of the posts linked above in fact include something which basically leads to a proof.)
Still, I think that it is to have somewhere this nice fact as a reference. And I wasn't able to find on this site a question specifically about this problem.
I can post an answer myself - but I wanted to give others an opportunity to make a post first.
 A: 
$$\large \Delta=\color{green}\blacktriangle+\color{red}\blacktriangle+\color{blue}\blacktriangle$$
$$\frac{ab}2=\frac{ar}2+\frac{br}2+\frac{cr}2$$
$$ab=(a+b+c)r$$
$$ab(a+b-c)=(a+b+c)(a+b-c)r$$
$$ab(a+b-c)=[(a+b)^2-c^2]r$$
$$ab(a+b-c)=(\underbrace{a^2+b^2-c^2}_{0}+2ab)r$$
$$ab(a+b-c)=2ab\cdot r$$
$$r=\frac{a+b-c}2$$
A: 
By the squares method,
$$r^2+r(a-r)+r(b-r)=r\,\dfrac{a+b+c}2,$$
$$2(a+b-r)=a+b+c,$$
$$\color{green}{\mathbf{r=\dfrac{a+b-c}2.}}$$
Then
$$R+r=\dfrac c2+r=\dfrac{a+b}2\le\sqrt{ab\mathstrut}\,=\sqrt{2S}\,.$$
A: Here's an approach that I don't think I've seen before (but don't doubt exists in the literature):

A: $$\begin{align*}r&=\frac{\Delta}s\\&=\sqrt{\frac{(s-a)(s-b)(s-c)}{s}}
\\&=\sqrt{\frac{({a+b-c})({a-b+c})({-a+b+c})}{8s}}
\\&=\sqrt{\frac{({a+b-c})[c^2-({a-b})^2]}{8s}}
\\&=\sqrt{\frac{({a+b-c})(2ab)}{8s}}
\\&=\sqrt{\frac{({a+b-c})}{2}.\frac{\Delta}{s}}
\\&=\sqrt{\frac{({a+b-c})}{2}.r}\end{align*}$$
$$\implies r=\frac{a+b-c}2,$$
A: Splitting the right-angled triangle into 3 triangles of bases $a$, $b$ and $c$ and the same height $r$（the in-radius）yields
$$
\begin{aligned}
\frac{r a}{2}+\frac{r b}{2}+\frac{r c}{2} &=\frac{a b}{2} \\
r(a+b+c) &=a b \\
r &=\frac{a b}{a+b+c} \cdot \frac{a+b-c}{a+b-c} \\
&=\frac{a b(a+b-c)}{a^{2}+b^{2}+2 a b-c^{2}} \\
&=\frac{a+b-c}{2}\quad \left(\because c^{2}=a^{2}+b^{2}\right)
\end{aligned}
$$
A: 
Let the tangent points be $A'$, $B'$ and $C'$ labelled in the usual way.
Then, since tangents from a point to a circle have equal length, $CB'=r=CA'$.
Therefore, for the same reason, $$AB'=AC'=b-r$$ and $$BA'=BC'=a-r$$
And since $AC'+BC'=c$, we get $a-r+b-r=c$ and hence the result.
A: We can consider the triangle formed by $(a, 0), (0, b), (0, 0)$ in the Cartesian Plane and proceed to find the point of intersection of the angular bisectors.
One angular bisector is clearly the line $y = x$.
For the other one, assume that the angle at (a, 0) to be $\theta$. The angular bisector is $y = -\tan \frac{\theta}{2}x+ a\tan \frac{\theta}{2}$.
The point of intersection these lines is
$$
\left(\frac{a\tan\frac{\theta}{2}}{1 + \tan\frac{\theta}{2}}, \frac{a\tan\frac{\theta}{2}}{1 + \tan\frac{\theta}{2}}\right)
$$
which means that the inradius is just $\frac{a\tan\frac{\theta}{2}}{1 + \tan\frac{\theta}{2}}$. Starting from $\tan\theta = \frac{b}{a}$, it is easy to show that $\tan\frac{\theta}{2} = \frac{c - a}{b}$.
$$
\begin{align}
\frac{a\tan\frac{\theta}{2}}{1 + \tan\frac{\theta}{2}} &= \frac{a}{2}\tan\theta \left(1 - \tan \frac{\theta}{2}\right) \\
&= \frac{b}{2} \left(1 - \frac{c - a}{b}\right) \\
& = \frac{a+b-c}{2}
\end{align}
$$
A: Labeling in Linked Wiki was incorrect. Vertex $C$ should have been more suitably labeled/placed at the vertex containing the right angle. Vertices  A,B,C ordering should correctly be:

We have in-radius $r$
$$r=\frac{\Delta}s =\sqrt{\frac{s(s-a)(s-b)(s-c)}{s^2}}=\frac{a+b-c}{2}$$
on simplification using the cut & pasted image above

also depicts a correct relation for in-radius $r$ as can be verified by algebraic cross-multiplication leading to Pythagoras thm of the right triangle:
$$ (a+b)^2-c^2= 2ab \to c^2= a^2+b^2. $$
A: \begin{align}
r &=\frac{\Delta}{s} \\
 &=\frac{\frac{ab}2}{\frac{a+b+c}2} \\
 &=\frac{ab}{a+b+c} \\
&=\frac{\frac{(a+b)^2-c^2}{2}}{a+b+c}\\
&=\frac{(a+b-c)(a+b+c)}{2(a+b+c)}\\
\Rightarrow r=\frac{a+b-c}2
\end{align}
