0
$\begingroup$

Let m, n be positive integers.

Let $x^2+2mx-n=p^2$ for some p which is a positive integer.

How does one solve for x?

Sorry forgot this: x must be an integer.

  • 0
    For different p, you shall get an at most countable collection of solutions. Are you interested in any particular type of solution, please mention so.2012-11-14

3 Answers 3

2

We change notation slightly, to make it clear that what is called $p$ is variable.

Our equation can be rewritten as $(x+m)^2-m^2-n=y^2,$ and then as $(x+m)^2-y^2=m^2+n,$ or equivalently $[(x+m)-y][(x+m)+y]=m^2+n.$ If $m^2+n$ is of the form $4k+2$, there are no integer solutions. For suppose to the contrary that there is a solution $(x,y)$. Note that $(x+m)-y$ and $(x+m)+y$ differ by an even number $2y$. So they are both odd or both even. If they are both odd, then their product cannot have shape $4k+2$. And it cannot have shape $4k+2$ if both are even.

Now assume first that $m^2+n$ is odd. Let $s$ be any divisor of $m^2+n$, and let $t=(m^2+n)/s$. We can solve the system of linear equations $(x+m)-y=s$, $(x+m)+y=t$ for $x$ and $y$. In particular, we get $y=\frac{1}{2}(t-s)$. This is positive if, for example, we let $s$ be any positive divisor of $m^2+n$ which is less than $\sqrt{m^2+n}$. We also get positive $y$ if $s$ is a negative divisor of $m^2+n$ which is less than $-\sqrt{m^2+n}$.

If $m^2+n$ is a multiple of $4$, $s$ and $t$ must be chosen to be both even. Apart from that, the analysis is the same.

In both the case $m^2+n$ is even, and the case $m^2+n$ is divisible by $4$, all integer solutions of our Diophantine equation are obtained as described above from factors of $m^2+n$.

Remark: If we know the prime power factorization of $m^2+n$, we can find an expression for the number of solutions of our diophantine equation.

  • 0
    Well, if $m^2+n$ is odd, we can use the trivial factorization $m^2+n=st$ where $s=1$ and $t=m^2+n$ to get one solution. And if $m^2+n$ is divisible by $4$, we can use the semi-trivial factorization $m^2+n=st$ where $s=2$ and $t=(m^2+n)/2$. So when there is a solution, we can always find **one** easily. But getting **all* the integer solutions is essentially equivalent to finding the prime power factorizations of $m^2+n$.2012-11-14
1

Given positive integers $m,n$ you want positive integers $x,p$ such that $x^2+2mx-n=p^2$ Rewrite as $x^2+2mx+m^2-p^2=n+m^2$ which is $(x+m+p)(x+m-p)=n+m^2$ Now for each way of factoring $n+m^2$, you get possible solutions. If $n+m^2=de$, then you have $x+m+p=d,\quad x+m-p=e$ which gives you $x=-m+(d+e)/2,\quad p=(d-e)/2$ For integers, you have to have $d,e$ both even, or both odd; for positive integers, you need $d\gt e$.

  • 0
    Finding $x$ and factoring $m^2+n$ are equivalent --- if you can do either one, you can do the other at (essentially) no extra charge.2012-11-14
0

If $m$, $n$, and $p$ are known values, then

$x^2+2mx-n=p^2$

$\Longrightarrow x^2 +2mx - (p^2+n)=0$.

This can be solved using the quadratic formula, giving

$x=\pm \sqrt{m^2+p^2+n}-m$ .

  • 0
    Judging by the solution, we need $m^2+p^2+n$ to be a perfect square.2012-11-14