I have to draw a visual representation of Pythagorean theorem. I had the initial approach of drawing the triangle in the middle and then work my way up by handling the squares. But it seems to much brute-force work. So is there any easy way to do this which could mean avoiding the brute-force approach ? (maybe with some library). Some sort of explanation or useful hint would suffice.

# [Tex/LaTex] Draw a demonstration of Pythagorean theorem with TikZ

tikz-pgf

## Best Answer

This is really just for fun and no competitor to Alain Matthes nice macros and routines. However, it is not too difficult to let Ti

kZ draw squares above/below a given line such that this line becomes one edge of the square.EDIT: Made the node labels upright and added the Pythagoras relation.EXPLANATION: The`measureme`

style makes TikZ measure the length of the edges (and store the result in a macro, which is called`\mylen`

in the example). The square style produces a, well, square, which is placed in the middle of a given edge such that it coincides with the edge.