# Diophantine equation in rationals $4 k + m^2=n^2$

I am trying to solve the Diophantine equation

$$4 k + m^2 = n^2$$

in rationals.

This looks very simple, but I stuck with this. I have represented this in terms of integers, but again no success:

$$k_2 n_2^2 m_1^2 + 4 k_1 n_2^2 m_2^2= k_2 n_1^2 m_2^2$$

where $k=\frac{k_1}{k_2},m=\frac{m_1}{m_2},n=\frac{n_1}{n_2}$.

EDITED:

I am trying to find such $k$ and $m$ that

$$4k+m^2$$ is square of rational number.

EDITED 2: The problem I am working on is finding of general solution for this equation.

• Do you want to solve it for $k$, $n$ and $m$? Or is $k$ a parameter? – ajotatxe Dec 30 '17 at 21:36
• I am looking for triples $k,n,m$. – Gevorg Hmayakyan Dec 30 '17 at 21:36
• Correct me if I am wrong, but I thought that when you say "Diophantine equation", the understanding is that you are looking for integer solutions. Is that correct? – Manolito Pérez Dec 30 '17 at 21:44
• Actually they are equivalent in general. – Gevorg Hmayakyan Dec 30 '17 at 21:48

## 2 Answers

If that you want is some like a parametrization, you can take $n = \frac{a + b}{2}$, $m = \frac{a - b}{2}$. Then $$k = \frac{n^2 - m^2}{4} = \frac{ \left( \frac{a + b}{2} \right)^2 -\left( \frac{a - b}{2} \right)^2 }{4} = ab / 4$$ So, all the solutions are given by $$\begin{cases} k = ab / 4 \\ n = \frac{a + b}{2} \\ m = \frac{a - b}{2} \end{cases}, \ \ a, b \in \mathbb{Q}$$

• Many thanks. Just wondering if this gives all the solutions? – Gevorg Hmayakyan Dec 30 '17 at 21:47
• Yes. If you have $m,n,k$ such that $4k + m^2 = n^2$, then solve the system $n = \frac{a + b}{2}$, $m = \frac{a - b}{2}$ for $a, b$ (it is easy to see that the solution are rationals number too). Then the equality $4k + m^2 = n^2$ implies $k = ab / 4$. – M159 Dec 30 '17 at 21:51
• This is overkill, since there is a trivial parametrization of all solutions - given $m,n$ there is exactly one $k$. – Thomas Andrews Dec 30 '17 at 22:30
• The question is to find such $k$ and $m$ that the $4k+m^2$ is square. For this we need some parametrization. This is the same complexity task as pythagorean triples or any other 2-order diophantine equation. – Gevorg Hmayakyan Dec 31 '17 at 19:17

There are clearly infinitely many solutions. For every rationals $m$ and $n$ just take $k=\frac{n^2-m^2}4$.

Looking for solutions with fixed $k$ is a bit more interesting, but still easy.

You can write $4k=(m+n)(m-n)$ and solve, for example, the system $$\left\{\begin{array}{rcl}m+n&=&4\\m-n&=&k\end{array}\right.$$ You can choose for the RHS's any expressions whose product is $4k$.

• Sorry my fault: Corrected the question – Gevorg Hmayakyan Dec 30 '17 at 21:39
• Many thanks, I am just looking for general solution. – Gevorg Hmayakyan Dec 30 '17 at 21:48