Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need help finding the solutions of the diophantine equation: $ x^2+4(ab)^n=y^2$. Please be aware the only one that I could find was $ x= \pm (a^n-b^n), y=\pm (a^n+b^n)$ using the quarter squares rule. I was told that are more integral solutions than that. Over $\mathbb{C}$ method was unsuccessfully attempted, not sure where i went wrong. Any help will be greatly appreciated. Thanks.

share|cite|improve this question
up vote 1 down vote accepted

Factor (as I'm sure you did) like this $$ 4(ab)^n = y^2-x^2 = (y-x)(y+x). $$ As $y-x$ and $y+x$ are of the same parity, they must both be even. Write $a=a_1a_2$ and $b=b_1b_2$ for integers $a_1,a_2,b_1,b_2$. Then $y-x=2(a_1b_1)^n$ and $y+x=2(a_2b_2)^n$, which implies $$ y = (a_2b_2)^n+(a_1b_1)^n, \qquad x=(a_2b_2)^n-(a_1b_1)^n.$$ That should be all of the solutions, I think — your original answer is a special case of this one (in which you did not consider factorizations of $a$ and $b$).

share|cite|improve this answer
I did not actually use this method but you have no idea how grateful i am for your concise demonstration. Thanks. – NumThcurious Oct 5 '13 at 7:40

Let $d=(ab)^n$, and let $uv=d$. Set $x+y=2u$ and $x-y=2v$. Then $x=u+v$ and $y=u-v$. This gives all solutions.

Thus our problem is equivalent to finding all pairs $(u,v)$ such that $uv=d$. There are the obvious solutions $u=\pm a^k b^l$, $v=\pm a^{n-k}b^{n-l}$, with $0\le k\le n$, $0\le l\le n$ (the plus signs go together, as do the minus signs). If $a$ and $b$ are distinct primes, these give all the solutions.

In general, suppose that $ab$ has the prime power factorization $$ab=p_1^{e_1}p_2^{e_2}\cdots p_m{e_m}.$$ Then there are
$$2(ne_1+1)(ne_2+1)\cdots(ne_m+1)$$ ordered pairs $(x,y)$ of integers such that $x^2+4(ab)^n =y^2$.

share|cite|improve this answer
I am always amazed by your expert inputs. Thanks. Any great pre-grad algebra book you can recommend? – NumThcurious Oct 5 '13 at 7:34
No, sorry, am out of touch about texts. – André Nicolas Oct 5 '13 at 7:36
ok. Thanks for your valuable inputs. Greatly appreciated. – NumThcurious Oct 5 '13 at 7:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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