# Homework Help: Find all solutions of the equation 2^x+3^y=z^2

1. Feb 23, 2012

### .d9n.

1. The problem statement, all variables and given/known data

Find all solutions in non-negative integers x, y, z of the equation
2^x + 3^y= z^2

2. Relevant equations

3. The attempt at a solution
not entirely sure how to go about it, im assuming maybe logarithms?

2=log(base Z) (2^x+3^y)

or maybe substitution

let
u=2^x so x=log(base 2)(u)
v=3^y so y=log(base 3)(v)
w=z^2 so 2=log(base z)(w)

u+v=w → 2^(log(base 2)(u))+3^(log(base 3)(v))=2^(log(base z)(w))

2. Feb 23, 2012

### morphism

Where is this from? The first thing I tried worked, but it produced a fairly long-winded solution so I'm reluctant to share it in case there's a simpler method... But here goes: Begin by considering your equation modulo 8, keeping in mind that z can't be divisible by 2.

3. Mar 1, 2012

### .d9n.

wasn't too sure what you mean with the modulo 8,
but this is what i have so far
so z cant be even as its equal to an odd plus an even number = odd
so when z=0, x=3 then z=3 and when y=2, x=4 then z=5
so if z^2-3^y has to be a perfect square then y has to be even and a power of 2 i.e.
2^x=z^2-3^y → 2^x = (z-3^2^w)^2

4. Mar 2, 2012

### .d9n.

so far i have

2^x + 3^y = z^2 [1]
where x, y, and z are non-negative integers.
We can see that [1] is a congruence modulo 8:
3^y = z^2 (mod 8) [2]
When z=1 and and y=2 we have
3^2 = 1 (mod 8) [3]
and by Fermat's theorem. So this means that y must be even.
As y is even, we can write y = 2k for some integer k. So we have:
3^2k + 2^x = z^2
z^2 - 3^2k = 2^x
(z + 3^k)(z - 3^k) = 2^x [4]
This means that the left hand side must be a power of 2, and therefore each factor i.e. (z+3^k) must also be a power of 2. But its not possible to have both factors on the left hand side divisible by 8, as this would imply that their difference
(z + 3^k) - (z - 3^k) = 2*3^k
would be divisible by 8, which is clearly impossible. The only power of 8 that is not a multiple of 8 is 8^0 = 1. So therefore one of the factors must be 1, and this is obviously the smaller factor; we have:
z- 3^k = 1
z = 3^k + 1 [5]
If we substitute that into [4], we obtain:
(3^k+1+3^k )(3^k+1-3^k )=2^x
2∙3^k + 1 = 2^x
2∙3^k = 2^x - 1 [6]
and this means that 2^x - 1 must be twice a power of 3.
So if k = 0, we have 2^x - 1 = 2, which doesn’t work. If k = 1, we have:
6 = 2^x - 1
where the LHS comes out even and the RHS comes out odd, so think i may have gone wrong somewhere, any ideas?

5. Mar 9, 2012

### morphism

Sorry, I'm too tired to read all that, so let me indicate what I'd meant with my hint.

Looking at the equation mod 8 and mod 3, and using the fact that $2\nmid z$ and $3\nmid z$, we can conclude that x and y must be even. Thus the equation $$(2^{x/2})^2 + (3^{y/2})^2 = z^2$$ is primitive Pythagorean, and the solutions to such equations are fully known (google it).

If you write down a parametrization for these Pythagorean triples, and use the fact that the only integer solutions to $$2^a = 3^b + 1$$ are $(a,b) \in \{(1,0), (2,1)\}$ (easy to prove), you should be able to obtain all positive integral solutions (x,y,z) to the original equation. (I got (3,0,3) and (4,2,5) as the only solutions.)

6. Mar 12, 2012

### .d9n.

this is what i have so far, but think i may have gone wrong somewhere, any ideas?

We are looking for solutions of:
2^x + 3^y = z^2 [1]
where x, y, and z are non-negative integers.
We can see that [1] is a congruence modulo 8:
3^y = z^2 (mod 8) [2]
When z=1 and and y=2 we have
3^2 = 1 (mod 8) [3]
and by Fermat's theorem. So this means that y must be even.
As y is even, we can write y = 2k for some integer k. So we have:
3^2k + 2^x = z^2
z^2 - 3^2k = 2^x
(z + 3^k)(z - 3^k) = 2^x
We can see that [1] is a congruence modulo 3:
2^x = z^2 (mod 3) [4]
When z=1 and and y=2 we have
2^x = 1 (mod 3) [5]
and by Fermat's theorem. So this means that x must be even.
As x is even, we can write x = 2k for some integer l. So we have:
3^y + 2^2l = z^2
z^2 - 2^2l = 3^y
(z + 2^l)(z - 2^l) = 3^y
So we are left with
2^2l + 3^2k = z^2
(2^l )^2+ (3^k )^2=z^2 [6]
Which is a Pythagorean triple, where a^2+b^2=c^2. Where a=2^(x/2),b=3^(y/2) and c=z, we can assume that a,b,c are coprime due to Fermat’s Lemma.
We know that c has to be odd because if we assume c is even, then there exists another value C such that c=2∙C. Also that c^2 is divisible by 4 since
c^2=(2C)^2 =4C^2
We know a and b must be odd because a,b,c are coprime. As a and b are odd there must exist values A and B such that
a=2A+1,b=2B+1
but a^2+b^2 cannot be divisible by 4 since
a^2+b^2=(2A+1)^2+(2B+1)^2=4A^2+4A+1+4B^2+4B+1=4(A^2+A+B^2+B)+2
we have a contradiction so c is odd.
So we have a^2=(c+b)(c-b)and c+b and c-b must be even since c and b are odd. So therefore there must exist u,v,w such that
a=2u,c+b=2v,c-b=2w
which means that (2u)^2=(2v)(2w) dividing both sides by 4 gives us u^2=vw.
If we assume v and w are not coprime, then there exists d such that d>1 and d divides both v,w, then d divides both v+w and v-w, but
c+b +c-b=2v+2w
so 2c=2v+2w which means that c=v+w so d divides c.
Also c+b-(c+b)=2v-2w. So 2b=2v-2w which means that b=v-w, so d divides b. Which is a contradiction as c and b are coprime from [6].
So we reject our assumption and v and w are coprime. By properties of coprimes we know that v and w are squares of themselves. So there exists p,q such that
v=p^2,w=q^2
and we have our solutions since
c=v+w=p^2+q^2
b=v-w=p^2-q^2
a=2u=2pq (As u^2=vw which means u=pq)
We know p,q are relatively prime and opposite parity as z is odd, so we are left with.
(p^2+q^2)=(2pq)^2+(p^2-q^2 )^2

so z=c=v+w=p^2+q^2,3^(y/2)=b=v-w=p^2-q^2 and 2^((x/2) )=a=2u=2pq

7. Mar 28, 2012

### morphism

Okay, so we know that 2^(x/2), 3^(y/2) and z are a primitive Pythagorean triple. This means that we can write 2^(x/2)=2nm, 3^(y/2)=n^2-m^2 and z=n^2+m^2 for some integers n and m, with only n even (say). From the first of these equations we find that m=1 and n=2^(x/2 - 1). But then the second equation becomes 3^(y/2) = 2^(x-2) - 1.

This is an equation of the form 2^a = 3^b + 1, and we are looking for integral solutions to such an equation. This forces $b\geq0$ (for otherwise 2^a won't be an integer), which in turn implies that $a\geq1$. I claim that $a \leq 2$ as well. Indeed, if a>2, then 3^b+1=0 mod 8, and this leads to a contradiction. Thus a is either 1 or 2. From here it's easy to see that the only possible solutions (a,b) are (1,0) and (2,1).

Returning to our problem, we see that $(x-2,y/2) \in \{(1,0), (2,1)\}$. You can take it from here.