Prove that a number composed of only $2n$ "1"s, minus another number composed of only $n$ "2"s, is a perfect square.
Examples:
$$11-2 = 9 = 3^2$$
$$1111 - 22 = 1089 = 33^2$$
My try
I saw that I can rearrange some of the "equations" like this
Examples: $$1111-22 = 101(11)-(11)2=11(101-2)=11\cdot99 = 11^2 \cdot 9 = 11^2 \cdot3^2 = (11\cdot 3)^2$$
$$111111-222 = 1001(111)-(111)2 = 111(1001-2) = 111 \cdot 999 = 111^2 \cdot9 = (111\cdot 3)^2$$
I think this is enough to prove that statement but I want a more "elegant" or general way (maybe an algebraic way?), and also to know if my solution is correct.
The number composed of $n$ ones is $(10^n-1)/9$. So your number is $$\frac{10^{2n}-1}9-2\frac{10^n-1}9=\frac{a^2-1-2(a-1)}9$$ with $a=10^n$. I'll leave you to carry on...