When is the fraction $\frac{n+7}{2n+7}$ the square of a rational number?

261 Views Asked by At

Find all positive integers $n$ such that the fraction $\dfrac{n+7}{2n+7}$ is the square of a rational number.

The answer says $n = 9,57,477$, but how do we prove this? I wrote $\dfrac{n+7}{2n+7} = \dfrac{a^2}{b^2}$ for some $a,b \in \mathbb{Z^+}$ and $\gcd(a,b) = 1$. We know that $\gcd(n+7,2n+7) = \gcd(n+7,7) = 1,7$ and so $n+7$ and $2n+7$ must both be perfect squares or their greatest common divisor is $7$. How do we find all values for which this is the case?

3

There are 3 best solutions below

2
On

There are more solutions (n<1000000): $$ \begin{array}{c} 9 \\ 57 \\ 168 \\ 477 \\ 2109 \\ 5880 \\ 16377 \\ 71817 \\ 199920 \\ 556509 \\ \end{array} $$ so you just plug these values of $n$ and check otherwise the question does not make sense. Also One solution in your list is missing for n<500.

Added after observation of ross-millikan:

$n+7$ and $2n+7$ can have common multiplier, is so than $2*(n+7)-(2n+7)$ is also devisible by the same number which is clearly $7$, so the theorem is that if numerator and denominator have a common multiplier it can only be $7$. Thus we have two possibilities

a) $n+7=a^2$ and $2n+7=b^2$

b) $n+7=7 a^2$ and $2n+7=7 b^2$

for b) n should be divisible by $7$

4
On

$$\gcd(n+7,2n+7)=\gcd(n+7,n)=\gcd(7,n)\in\{1,7\}$$

If the $\gcd=1$, then $n+7,2n+7$ are both squares:

$$n+7=a^2,2n+7=b^2\implies 2a^2-b^2=7$$

If the $\gcd=7$, then $\frac{n+7}{7},\frac{2n+7}{7}$ are both integer squares. Write $n=7m$:

$$m+1=a^2,2m+1=b^2\implies2a^2-b^2=1$$

Finding exact solutions from here requires study of Pell's equation, as indicated in the comments.

  • The first equation has solutions starting with $\{(2,1),(8,11),\cdots\}$

  • The second equation has solutions starting with $\{(1,1),(5,7),(41,29),\cdots\}$.

These can be generated by looking at $(3+\sqrt2)(1+\sqrt2)^{2k},(1+\sqrt2)^{2k+1}$ respectively for integer $k$. Noting that $\frac{1}{1+\sqrt2}=-(1-\sqrt2)$ tells us that for the second of these sequences, we cann afford to simply look at $k\ge0$.

In the first case, given $2a^2-b^2=7$, note that taking $n=b^2-a^2$ gives $a^2=n+7,b^2=2n+7$ as desired, i.e. the fraction in question is a square. A slight adaptation of this resolves the second case.

Clarification: When I say "these can be generated by looking at $(a+b\sqrt2)^k$", I refer to the fact that by writing $(a+b\sqrt2)^k=A_k+B_k\sqrt2$ for integers $A_k,B_k$, we will have $2B_k^2-A_k^2=1$ or $7$, depending on this sequence. This method makes use of techniques from algebraic number theory, where we learn that the function $N:a+b\sqrt2\to a^2-2b^2$ is multiplicative.

0
On

Because $2(n+7)-(2n+7)=7$, we know that $\gcd(n+7,2n+7)\mid7$.

Since we only want positive $n$, this implies one of

  1. $n+7$ and $2n+7$ are squares, or

  2. $n+7$ and $2n+7$ are each $7$ times a square.


Case 1: Let $p^2=n+7$. Then we need $q^2=2n-7=2p^2-7$. This gives the Pell equation $$ 2p^2-q^2=7\tag{1} $$ Equation $(1)$ has two sequences of solutions: $$ (p,q)\in\{\overbrace{\ \ \ (2,1)\ \ \ }^{n=-3},\overbrace{\ \ (8,11)\ \ }^{n=57},\overbrace{\ (46,65)\ }^{n=2109},\dots\}\tag{2} $$ and $$ (p,q)\in\{\overbrace{\ \ \ (4,5)\ \ \ }^{n=9},\overbrace{\ (22,31)\ }^{n=477},\overbrace{(128,181)}^{n=16377},\dots\}\tag{3} $$ Both of which satisfy the recursion $$ (p_k,q_k)=6(p_{k-1},q_{k-1})-(p_{k-2},q_{k-2})\tag{4} $$ We can solve the recursion $(4)$ for $(2)$ with $$ p_k=\tfrac14\left(4+\sqrt2\right)\left(3+2\sqrt2\right)^k+\tfrac14\left(4-\sqrt2\right)\left(3-2\sqrt2\right)^k\tag{5} $$ and $$ q_k=\tfrac12\left(1+2\sqrt2\right)\left(3+2\sqrt2\right)^k+\tfrac12\left(1-2\sqrt2\right)\left(3-2\sqrt2\right)^k\tag{6} $$ Additionally, $(5)$ and $(6)$ with negative $k$ gives $(3)$ with negative $q$.

Therefore, we get the solutions for $n$ as $$ \begin{align} n_k &=p_k^2-7\\ &=\bbox[5px,border:2px solid #C0A000]{\frac18\left[\left(9+4\sqrt2\right)\left(3+2\sqrt2\right)^{2k}+\left(9-4\sqrt2\right)\left(3-2\sqrt2\right)^{2k}-42\right]}\tag{7} \end{align} $$ where $k\in\mathbb{Z}$. For example, if $k\in\{-5,-4,-3,-2,-1,0,1,2,3,4,5\}$, $$ n_k\in\{18905097,556509,16377,477,9,-3,57,2109,71817,2439837,82882809\} $$


Case 2: Let $7p^2=n+7$. Then we need $7q^2=2n+7=14p^2-7$. As above, this leads to the Pell's Equation $$ 2p^2-q^2=1\tag{8} $$ Equation $(8)$ has the solutions $$ (p,q)\in\{\overbrace{\ \ \ (1,1)\ \ \ }^{n=0},\overbrace{\ \ \ (5,7)\ \ \ }^{n=168},\overbrace{\ (29,41)\ }^{n=5880},\dots\}\tag{9} $$ which satisfies $(4)$.

We can solve the recursion $(4)$ for $(9)$ with $$ p_k=\tfrac14\left(2+\sqrt2\right)\left(3+2\sqrt2\right)^k+\tfrac14\left(2-\sqrt2\right)\left(3-2\sqrt2\right)^k\tag{10} $$ and $$ q_k=\tfrac14\left(2+2\sqrt2\right)\left(3+2\sqrt2\right)^k+\tfrac14\left(2-2\sqrt2\right)\left(3-2\sqrt2\right)^k\tag{11} $$ Formulas $(10)$ and $(11)$ with negaitve $k$ just give $(9)$ with negative $q$. Thus, we only need consider $k\ge0$. $$ \begin{align} n_k &=7p_k^2-7\\ &=\bbox[5px,border:2px solid #C0A000]{\frac78\left[\left(3+2\sqrt2\right)^{2k+1}+\left(3-2\sqrt2\right)^{2k+1}-6\right]}\tag{12} \end{align} $$ where $k\in\mathbb{Z}^{\ge0}$. For exmple, if $k\in\{0,1,2,3,4,5\}$, $$ n_k\in\{0,168,5880,199920,6791568,230713560\} $$


Complete Closed and Recursive Solutions

Collecting the results in $(7)$ and $(12)$, and reindexing for monotonicity with $k\ge1$, we get that the closed form for the complete list of solutions is $$ \hspace{-8mm}\bbox[5px,border:2px solid #C0A000]{ \begin{bmatrix}n_{3k-2}\\n_{3k-1}\\n_{3k}\end{bmatrix} =\frac18\left(\,\begin{bmatrix}9-4\sqrt2\\9+4\sqrt2\\21+14\sqrt2\end{bmatrix}\left(3+2\sqrt2\right)^{2k}+\begin{bmatrix}9+4\sqrt2\\9-4\sqrt2\\21-14\sqrt2\end{bmatrix}\left(3-2\sqrt2\right)^{2k}-\begin{bmatrix}42\\42\\42\end{bmatrix}\,\right)}\tag{13} $$ and a recursive list of solutions is given by
$\scriptsize\begin{bmatrix}n_1\\n_2\\n_3\end{bmatrix}=\begin{bmatrix}9\\57\\168\end{bmatrix},\quad\scriptsize\begin{bmatrix}n_4\\n_5\\n_6\end{bmatrix}=\begin{bmatrix}477\\2109\\5880\end{bmatrix},\quad\scriptsize\begin{bmatrix}n_7\\n_8\\n_9\end{bmatrix}=\begin{bmatrix}16377\\71817\\199920\end{bmatrix},\quad$ and $$ \bbox[5px,border:2px solid #C0A000]{ \begin{bmatrix}n_{3k+1}\\n_{3k+2}\\n_{3k+3}\end{bmatrix}=35\begin{bmatrix}n_{3k-2}\\n_{3k-1}\\n_{3k}\end{bmatrix}-35\begin{bmatrix}n_{3k-5}\\n_{3k-4}\\n_{3k-3}\end{bmatrix}+\begin{bmatrix}n_{3k-8}\\n_{3k-7}\\n_{3k-6}\end{bmatrix} }\tag{14} $$