$$(2n + 1)^2 + (2n^2 + 2n)^2 = (2n^2 +2n +1)^2$$
It can be used to generate infinitely many sides of right-angled triangles with integer lengths by putting values of $n = 1, 2, 3, ... $
I wanted to know that how we came to this equation. How do we know that putting n = 1, 2, 3, … into this we'll get all the sides of a right-angled triangle. I'm trying to find more about this on the internet, if you can help me what should I find about.
If you start with the sequence of square numbers, and take all the differences between consecutive terms, you get all the odd numbers in sequence. For instance, $$ 2^2 - 1^2 = 3\\ 3^2 - 2^2 = 5\\ 4^2-3^3 = 7 $$ Some times, that odd number happens to be a square itself. For instance, we have $$ 5^2 - 4^2 = 9 = 3^2\\ 13^2 - 12^2 = 25 = 5^2 $$ Rearranging these, we get Pythagorean triples: $$ 3^2 + 4^2 = 5^2\\ 5^2 + 12^2 = 13^2 $$ If we want to describe all the different Pythagorean triples that appear this way, we end up with exactly your expression.