TITLE: If $n$ can be expressed as $2x^2+3y^2$ with integers $x$ and $y$, then so can $7n$.
QUESTION [8 upvotes]: The problem is:

Let us say that a positive integer $n$ is obtainable if there exist integers $x$ and $y$ such that $n=2x^2+3y^2$. If $n$ is obtainable, prove that $7n$ is also obtainable.

I tried doing that
$$2(x+a)^2+3(y+b)^2=14x^2+21y^2$$
which simplifies to
$$4ax+2a^2+6yb+3b^2=12x^2+18y^2$$
but then I seem to be caught in a loop.
Am I on the right direction and can someone give me a hint?
This is a homework question btw.

REPLY [13 votes]: We have
$$7n = 2(x+3y)^2 +3 (2x-y)^2$$

REPLY [5 votes]: I would modify your substitution to avoid linear term.
$$2(x+ay)^2 + 3(y+bx)^2 = 14x^2+21y^2$$
$$2(x^2+2axy+a^2y^2)+3(y^2+2bxy+b^2x^2)=14x^2+21y^2$$
$$(2+3b^2)x^2 +(4a+6b)xy + (2a^2+3)y^2=14x^2+21y^2$$
Can we find $(a,b)$ such that the equality holds for all $x,y$? I will leave the investigation to you.