Integer solutions to $\sqrt{a} + \sqrt{b} = \sqrt{c}$

An example I can see using basic algebra is $\sqrt{2} + \sqrt{8} = \sqrt{18}$, but is there a general method to find integer solutions to the problem? Another question: say you are given the value of $c$; can you find the values of $a$ and $b$?


Note that, since $a,b,c\in\mathbb N$, we have $$ \sqrt{a}+\sqrt{b}=\sqrt{c}\ \iff \ a+b+2\sqrt{ab}=c. $$ So a necessary and sufficient condition for $a,b,c$ to exist is that $2\sqrt{ab}\in\mathbb N$, i.e. $$ ab=\frac{n^2}4,\ \text{ for some }n\in\mathbb N; $$ as an integer is even exactly when its square is, this last condition occurs if and only if $$ ab=m^2\ \text{ for some }m\in\mathbb N. $$ Finding a solution given a $c$ is probably not easy; it can surely be done by exhaustion if $c$ is not too big.


If $a,b$ have a divisor $d$ in common, then $d$ is also a divisor of $c = a+b+2\sqrt{ab}=d\cdot\left(\frac ad+\frac bd+2\sqrt{\frac ad\frac bd}\right)$. Therefore, we can concentrate on the case that $\gcd(a,b)=1$.

Assume neither $a$ nor $b$ is a perfect square. Then $b$ also not a square in $\mathbb Q(\sqrt a)$ because $b=(u+v\sqrt a)^2$ would imply $2uv\sqrt a=b^2-u^2-av^2$, i.e. $\sqrt a$ rational (if $uv\ne0$) or $\gcd(a,b)>1$ (if $u=0$, $b^2=av^2$) or $\sqrt b=|u|\in\mathbb Q$ (if $v=0$). Therefore the field $\mathbb Q(\sqrt a, \sqrt b)$ allows four automorphisms, induced by sending $\sqrt a\to \pm\sqrt a$ and $\sqrt b\to \pm \sqrt b$ with independant choices of signs. The four different corresponding values of $\pm\sqrt a\pm\sqrt b$ must be roots of the polynomial $X^2-c$, but this polynomial has only two roots, contradiction.

Therefore at least one of $a,b$ is a perfect square. Wlog. $a=r^2$ with $r\in \mathbb N$. Then the equation becomes $r+\sqrt b=\sqrt c$, i.e. $r^2+2r\sqrt b+b=c$, whence $\sqrt b$ is rational and thus $b$ is also a perfect square.

Conclusion: Given $c=uv^2$ with $u$ squarefree, the solutions of $$\sqrt a+\sqrt b=\sqrt c$$ with $a,b\in\mathbb N$ are given by $a=ur^2$, $b=u(v-r)^2$ with $1\le r< v$. ($r\le \frac v2$ if we additionally want $a\le b$).

Example: If $c=18$, then $u=2$, $v=3$. The only possible choice with $1\le r<\frac v2$ is $r=1$ and yields $$\sqrt{2}+\sqrt 8=\sqrt{18}.$$


I knew I had answered a similar (but more general) question elsewhere before.


Here's a somewhat more geometric solution. Excluding the trivial solution $(0,0,0)$, we can divide both sides by $\sqrt{c}$ to reduce the problem to the equivalent problem of finding all rational solutions to $$\sqrt{x}+\sqrt{y}=1.$$ The graph of this contains the point $(0,1)$. Given any other rational point $(a,b)$ on this graph, notice that the line connecting $(0,1)$ to $(a,b)$ will have rational slope $\le -1$. Conversely, I claim that if we draw a line through $(0,1)$ with rational slope $\le -1$, then it will hit this graph in another rational point.

To see this, let the line be $y=tx+1$ with $t$ rational. The intersection of the two graphs occurs at $$\sqrt{x}+\sqrt{tx+1}=1$$

Solving for $x$ gives $$x=\frac{4}{(t-1)^2}$$ and from $y=tx+1$ we get $$y=\frac{(t+1)^2}{(t-1)^2}.$$ These are all the rational points on this graph. To find all integers $(a,b,c)$ you can just plug in $t=\frac{r}{s}$ and clear denominators. You will get:

$$a=d(4s^2)$$ $$b=d(r+s)^2$$ $$c=d(r-s)^2$$

where $d\ge 1$.

The $d$ comes from the fact that if $\frac{x_1}{x_2}=\frac{y_1}{y_2}$ then $y_1=dx_1$ and $y_2=dx_2$ for some non-zero $d$.


Since the first part was answered, for the last part the answer is: Depends what you mean by it can be found.

First lets observe that the equation doesn't usually have unique solution. For example, if $c=n^2$, then $a=k^2, b=(n-k)^2$ is solution for all $0 \leq k \leq n$.

Similarly, for $c=n^2d$ then $a=k^2d, b=(n-k)^2d$ is solution for all $0 \leq k \leq n$. And in general, this equation will have some other solutions.

But, as pointed out, the equation has finitely many solutions (since $a,b \leq c$), thus all the possible solutions can be found.


Let $c=d n^2$ with $n\ge 0$ and with $d \gt 0$ square-free, i.e. $d$ has no repeated prime factors. $d$ is the product of the individual prime factors of $c$ which occur an odd number of times.

Then $a=d k^2$ and $b=d (n-k)^2$ with $0 \le k \le n$ are the only solutions to $\sqrt a + \sqrt b = \sqrt c$, and there are $n+1$ such pairs.

This is similar to N.S.'s solution, except for the restriction on $d$.

$18 = 2^1 \times 3^2$ so $d=2$ and thus $n=3$. So there are $n+1=4$ solutions to $\sqrt a + \sqrt b = \sqrt{18}$ namely

  • $\sqrt{0^2 \times 2} + \sqrt{3^2 \times 2} = \sqrt{3^2 \times 2}$ i.e.$\sqrt{0} + \sqrt{18} = \sqrt{18}$
  • $\sqrt{1^2 \times 2} + \sqrt{2^2 \times 2} = \sqrt{3^2 \times 2}$ i.e.$\sqrt{2} + \sqrt{8} = \sqrt{18}$
  • $\sqrt{2^2 \times 2} + \sqrt{1^2 \times 2} = \sqrt{3^2 \times 2}$ i.e.$\sqrt{8} + \sqrt{2} = \sqrt{18}$
  • $\sqrt{3^2 \times 2} + \sqrt{0^2 \times 2} = \sqrt{3^2 \times 2}$ i.e.$\sqrt{18} + \sqrt{0} = \sqrt{18}$