$A^2$ + $B^2$, $AB$, and $A + B$ are all integers.

Do both $A$ and $B$ have to be integers? If not, what is an example where they are not?


closed as off-topic by Victor Stafusa, Glorfindel, Peregrine Rook, Jaap Scherphuis, Mea Culpa Nay Jun 23 '18 at 5:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is off-topic as it appears to be a mathematics problem, as opposed to a mathematical puzzle. For more info, see "Are math-textbook-style problems on topic?" on meta." – Victor Stafusa, Glorfindel, Peregrine Rook, Jaap Scherphuis, Mea Culpa Nay
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    $\begingroup$ Note that if $AB$ and $A+B$ are integers, then $A^2+B^2=(A+B)^2-2AB$ is an integer. $\endgroup$ – noedne Jun 20 '18 at 18:55

No they do not! Here is an example:

$$A=-\sqrt2,\quad B=\sqrt2$$

and we have that

$$A+B=0,\quad AB=-2,\quad A^2+B^2=4$$


TheSimpliFire has a correct answer, but it may be worth saying a bit about how this works out in general.

First of all,

as noedne remarks in a comment, it suffices for $AB$ and $A+B$ to be integers; this guarantees that $A^2+B^2$ is also an integer.


consider the quadratic polynomial $(x-A)(x-B)$. Its roots are $A,B$. And it equals $x^2-(A+B)x+AB$. In other words, $A,B$ satisfy the given condition if and only if $A,B$ are the roots of a quadratic equation with leading coefficient 1 and other coefficients.

So, in particular,

we can take the quadratic equation to be $x^2-n=0$ where $n$ is an integer that isn't a perfect square, leading to $A,B=\pm\sqrt{n}$ as in TheSimpliFire's answer.

But there are many other solutions; for instance

if we take $x^2+x-1$ then $A,B=\frac{1\pm\sqrt5}2$; that is, our numbers are $\phi,-1/\phi$ where $\phi$ is the golden ratio.

In general,

if $m,n$ are integers with $n\ge0$ then $A,B=m\pm\sqrt{n}$ is a solution (if you don't mind complex numbers then you don't need the restriction on $n$); if $m,n$ are odd integers with $n$ of the form $4k+1$ then $A,B=\frac{m\pm\sqrt{n}}2$ is a solution (again, you need $n\ge0$ if you want to avoid complex numbers); these are all the solutions; and the ones where $A,B$ aren't integers are exactly those where $n$ isn't a perfect square.


I wanted to add why there is no solution if $A$ or $B$ is rational (this is implicit in Gareth's answer but I wanted to give an explicit reason). Suppose $A = \frac{x}{y}$ for integers $x$ and $y$ with no factors in common. Then, for some integer $C$, $B = \frac{Cy}{x}$ (since $AB$ is an integer). Since $A + B$ is an integer, $\frac{x}{y} + \frac{Cy}{x} = \frac{x^2 + Cy^2}{xy}$ is an integer. However, how can $y$ divide $x^2 + Cy^2$ if $x$ and $y$ have no common factors? This proves $A$ is irrational, and by symmetry so is $B$.

Now, if you combine this answer TheSimpliFire's, you get a proof that

$\sqrt{2}$ is irrational!


Not the answer you're looking for? Browse other questions tagged or ask your own question.