We know for all right triangles that:

From the latter we can deduce

Through substitution into our first equation, it follows that

And through standard algebra:

Substitute that back into