# Solving a particular system of Diophantine equations

Setup If we are given $$a,b,c,d$$, then the system of equations \begin{align} p+r & =a, \tag {1a}\\ pr+qs & =b, \tag {1b}\\ p(s+1)+qr+r & =c, \tag {1c}\\ 2pr+qs+2 & =d \tag {1d}\\ \end{align}

can be solved for $$p,q,r,s$$, not necessarily integers, because the equations are all independent. The outline is we find $$pr = d - b - 2$$ by solving Eqns. $$(1b), (1d)$$ then use it with $$(1a)$$ to solve for $$p,r$$. A similar approach is used for solving for $$q,s$$.

The linear diophantine equation

$$-2a+2b-2c+d = n \tag 2$$

has an infinite number of solutions in integers for $$a,b,c,d$$.

Question: Given only $$n$$, find all integer solutions for $$p,q,r,s,a,b,c,d$$ simultaneously satisfying Eqns. $$(1)$$ and $$(2)$$. How do we solve this?

Approach tried: I was able to find a particular solution

\begin{align} b & =d - 2 , \\ p & =0, \\ q & = {{c - a} \over {a}}, \\ r & =a, \\ s & =-{{a (d - 2)} \over {a - c}} = {{b} \over {q}}, \\ a(a - c) & ≠0. \end{align}

• You say "given $a,b,c,d$". So then there is only one choice for $n$, namely by $(2)$. For example, let $a=b=c=d=0$. Then $(2)$ just says $n=0$. What are the solutions of $(1)$? Then $p^2=2$, which has no integer solution. Commented Nov 7, 2022 at 14:45
• Indeed, $r=-p$ by $(1a)$, so that $-p^2=pr=-a-d-2=-2$, a contradiction. So it is not true, that $(1)$ can be solved for $p,q,r,s$ in general. Commented Nov 7, 2022 at 14:59
• @DietrichBurde: I have edited the questioin to clarify that only $n$ is given and we need solutions $a,b,c,d,p,q,r,s \in \mathbb{Z}$ satisfying Eqns. $(1)$ and $(2)$. In the initial setup, I didn't specify integer solutions for Eqn. $(1)$. However, the solutions tha we seek are integral for $a,b,c,d,p,q,r,s$.
– vvg
Commented Nov 7, 2022 at 15:33
• @vvg, Partial solution: Let $n=4m+2$ then we get integer solution $(p,q,r,s,a,b,c,d)=(3s+2m,\ 4+2s+4m,\ -m,\ s,\ 3s+m,\ ms-2m^2+4s+2s^2,\ 3s^2+3s-3m-4m^2,\ -2ms-4m^2+4s+2s^2+2)$. $m,s$ are arbitrary integers. Commented Nov 14, 2022 at 3:53
• @tomita : Nice. That solves for even $n$. If we solve for odd $n$, we should be done.
– vvg
Commented Nov 14, 2022 at 5:06

$$-2a+2b-2c+d = n\tag{2}$$ From equation $$(1)$$, equation $$(2)$$ becomes to $$-2p-4r+4pr+3qs-2p(s+1)-2qr+2=n$$ Let solve for $$p$$, then $$p = \frac{1}{2}\frac{-4r+2+3qs-2qr-n}{2+s-2r}$$ We consider the case for $$2+s-2r =1$$ and we get $$(r,s)=(1+m, -1+2m)$$.
Hence we get $$p = 1+2m+\frac{5}{2}q-2qm+\frac{1}{2}n$$ We know $$p$$ is integer when $$n$$ and $$q$$ have same parity.
$$\bullet$$ Case of $$(n,q)=(2h+1, 2k+1)$$: We get a partial solution for odd $$n$$: $$(p,q,r,s,a,b,c,d)=(4+5k-4mk+h,\ 2k+1,\ 1+m,\ -1+2m,\ (1-4k)m+5+5k+h,\ -4m^2k+(6+5k+h)m+3+3k+h,\ -8m^2k+(10+12k+2h)m+2+2k,\ -8m^2k+(6k+10+2h)m+9+8k+2h)$$ $$h,k,m$$ are arbitrary integers.
$$\bullet$$ Case of $$(n,q)=(2h, 2k)$$: We get a partial solution for even $$n$$: $$(p,q,r,s,a,b,c,d)=((2-4k)m+1+5k+h,\ 2k,\ 1+m,\ -1+2m,\ (3-4k)m+2+5k+h,\ (2-4k)m^2+(3+5k+h)m+1+3k+h,\ (4-8k)m^2+(3+12k+2h)m+1+2k,\ (4-8k)m^2+(6k+6+2h)m+4+8k+2h)$$ $$h,k,m$$ are arbitrary integers.