# Sums of two perfect squares

Show that if $q$ is a number that can be expressed as the sum of two perfect squares, then $2q$ and $5q$ can also be expressed as the sum of two perfect squares.

EDIT: I've recently revisited this problem and I found an elementary answer which I posted as an answer below.

-
Hint: $\rm\ 5(a^2\!+b^2) = (1^2\!+2^2)(a^2\!+b^2).\:$ Now apply the Brahmagupta composition formula. Similarly for $\:2 = 1^2\! + 1^2.\:$ – Math Gems Mar 1 '13 at 4:13
Suggestion: you may "accept" one answer per question asked. To accept an answer, you just click on the $\checkmark$ to the left of the answer you'd like to accept. (You get two reputation points for each answer accepted!) Once you acquire a little more reputation you can upvote answers as well, as many as you'd like! – amWhy Mar 4 '13 at 18:07

$2(a^2+b^2)=(a+b)^2+(a-b)^2$

$5(a^2+b^2)=(2+i)(2-i)(a+bi)(a-bi)=(2a-b+(a+2b)i)(2a-b-(a+2b)i)=(2a-b)^2+(a+2b)^2$

-
Oh seems your post arrived just before mine, and is similar. Will remove mine. – Macavity Mar 1 '13 at 3:14
Don't remove it, please. I find it useful to see multiple ways of solving a problem or stating a solution. Besides, you might get some points which you can redeem at a university near you. – marty cohen Mar 1 '13 at 3:30
These are special cases of the Brahmagupta-Fibonacci identity with $2=1^1+1^2, 5=2^2+1^2$ – Ross Millikan Mar 1 '13 at 3:52

In general, if $n = 2^{\gamma} p_1^{\alpha_1} p_2^{\alpha_2} \cdots p_k^{\alpha_k} q_1^{2\beta_1} q_2^{2\beta_2} \cdots q_l^{2\beta_l}$, where $p_i \equiv 1 \pmod 4$, $q_j \equiv 3 \pmod 4$ and $\gamma,\alpha_i,\beta_j \in \mathbb{Z}$, from Fermat's theorem on sums of two squares, we have that $$n = a^2 + b^2$$ We are given that $$q = c^2 + d^2$$ Hence, we get that $$nq = (a^2+b^2)(c^2+d^2) = (ac+bd)^2 + (ad-bc)^2$$

-

If $q = m^2 + n^2$
consider $(m+n)^2 + (m-n)^2$ and $(2m-n)^2 + (m + 2n)^2$

-

I found an elementary method that is a little more straightforward:

$$q=a^2 + (a+s)^2$$

$$q = 2a^2 + 2as + s^2$$

$$2q = 4a^2 + 4as + 2s^2$$

$$2q = 4a^2 + 4as + s^2 + s^2$$

$$2q = (2a+s)^2 + s^2$$

$$q=a^2 + (a+s)^2$$

$$q = 2a^2 + 2as + s^2$$

$$5q = 10a^2 + 10as + 5s^2$$

$$5q = 9a^2 + 6as + s^2 + a^2 + 4as + 4s^2$$

$$5q = (3a+s)^2 + (a+2s)^2$$

-