Find all the integral solutions to the equation $323x+391y+437z=10473$

Recall that - by linearity - the general solution of a non-homogeneous linear equation is obtained by $\color{#0a0}{\text{adding}}$ any particular solution $\rm P$ to the general solution $\rm H$ of the associated homogeneous equation. We can use this to reduce the solution of a trivariate linear Diophantine equation to the well-known bivariate case as below. Here I have followed the presentation that is implicit in the (unproved) formula applied in Robert's answer, and also appended a complete proof of that (unproven) formula.

Homogeneous solution: $\ 323 x + 391 y = - 437 z\ $ is solved as below:

$\gcd(323,391) = 17\mid 437z\,\Rightarrow\, 17\mid z,\ $ so $\ z = 17 m\,$ for $\,m\in\Bbb Z$

Cancelling $\,17\,$ above yields: $\ \,19x\, +\, 23 y\, = -437m.\, $ Recursively solving this bivariate case:

$\ \ \ $ Particular solution: $\bmod 19\!:\ 4y\equiv 0\iff y\equiv 0,\ $ so $\ x = {\large \frac{-437m}{19}} = -23m$

$\ \ \ $ Homogeneous solution: $\ 19x+23y = 0\iff {\large \frac{y}x =\, \frac{\!\!-19}{23}}\!$ $ \iff$ $(x,y) = (23k,-19k)$

$\ \ \ \ \color{#0a0}{\text{Adding}}\rm\ P\!+\!H\!:$ $\ (x,y,z)\, =\, (23k,\, -19(m\!+\!k),\, 17m) = $ general homogeneous solution.

Particular solution $\ (x,y,z) = (8,9,10)\ $ is obtained as follows:

$10473 = 437z + 17(\color{#c00}{19x\!+\!23y}) =: 437z + 17\,\color{#c00}T $

$\!\bmod 17\!:\ z \equiv {\large \frac{10473 }{437}\equiv \frac{1}{12} \equiv \frac{18}2\frac{18}6}\equiv 9\cdot 3\equiv 10\ $ so $\ \color{#c00}T = {\large \frac{10473-437(10)}{17}} = \color{#c00}{359}$

$\color{#c00}{19x\!+\!23y = 359}\ $ $\Rightarrow \bmod 19\!:\ \begin{align}4y&\equiv -2\\ 2y&\equiv -1\equiv 18\end{align}\!\!\iff y\equiv 9\ $ so $\,x = {\large \frac{359-23(9)}{19}} = 8$

$\color{#0a0}{\text{Adding}}\rm\ P\!+\!H\!:$ $\,\ \bbox[5px,border:1px solid #c00]{(x,y,z) = (8\!+\!23k,\, 9\!-\!19(m\!+\!k),\, 10\!+\!17m)}\:$ is a general solution.


Below is a complete proof of the cited formula - proved exactly as above.

Theorem $ $ Let $\,a,b,c\in\Bbb Z\,$ with gcd $\,(a,b,c) = 1,\,$ let gcd $\, (a,b) =: g,\,$ and $\,a' = a/g,\ b' = b/g.$

Let $\ \ z_0,\, t_0\in\Bbb Z\,\ $ be any solution of $\, \ c\,z\:\! +\ g\,t\, =\, d$
and $\ \color{#90f}{u_0,v_0}\in\Bbb Z\ $ be any solution of $\ \, a'u + b'v\, =\, c$
and $\ x_0, y_0\in\Bbb Z\ $ be any solution of $\ \ a'x + b'y =\:\! t_0$.

Then $\,ax + by + cz = d\,$ has the general solution $\,\ \begin{align} x &= x_0 + b'k - u_0 m\\ y &= y_0 - a'k - v_0 m\\ z &= z_0 + gm\end{align}\,\ $ for any $\,k,m\in\Bbb Z$

Proof: $ $ Homogeneous solution: $\ a x + b y = -c z\ $ is solved as below:

$(a,b)\!=\! g\mid cz\overset{(g,\,c)=1}\Rightarrow\! g\mid z,\ $ so $\ z = g m,\,m\in\Bbb Z,\,$ by $(g,c)\! =\! (a,b,c)\!=\!1\,$ & $ $ Euclid's Lemma.

Cancel $\,g\,$ in $\,ax+by = -cz\,$ $\Rightarrow \,a'x\, +\,b' y\, = -cm.\, $ Recursively solving this bivariate case:

$\ \ \ $ Particular solution: $\ (x,y) = (-u_0m,-v_0m)\ $ by $\,\color{#90f}{u_0,v_0}\,$ hypothesis scaled by $\,-m$.

$\ \ \ $ Homogeneous solution: $\ a'x+b'y = 0\iff {\large \frac{y}x =\, \frac{\!\!-a'}{b'}}\!$ $ \iff$ $(x,y) = (b'k,-a'k)$

$\ \ \ \ \color{#0a0}{\text{Adding}}\rm\ P\!+\!H\!:$ $\ (x,y,z)\, =\, (b'k\!-\!u_0m,\, -a'k\!-\!v_0m,\, gm) = $ general homogeneous solution.

Particular solution $\,\ (x,y,z) = (x_0,y_0,z_0)\ $ is obtained as follows:

$d = cz + g(\color{#c00}{a'x\!+\!b'y}) =: cz + g\,\color{#c00}t\ $ has solution $\,(z,\color{#c00}t) = (z_0,\color{#c00}{t_0})\,$ by hypothesis.

and also: $\, \ \ \ \color{#c00}{a'x\!+\!b'y = t_0}\,\ $ has $ $ as $ $ a $ $ solution: $\ \, (x,y) = (x_0,y_0)\,$ by hypothesis.

Therefore $\,(x,y,z) = (x_0,y_0,z_0)\,$ is a particular solution.

$\color{#0a0}{\text{Adding}}\,$ the Particular and Homogeneous solutions yields the claimed general solution.

Remark $ $ If $\, e := (a,b,c) > 1\,$ then $\,e\mid d\,$ so cancelling $e$ in the equation reduces to the above case.


Since $\gcd(323,391,437)=1$ divide $10473$ we are supposed to find infinite solutions.

Hint. First find a solution $u_0$, $v_0$ of $$19u + 23 v = 437$$ where $19=323/17$ and $23=391/17$ with $17=\gcd(323,391)$. Then let $t_0$, $z_0$ be a solution of $$17t+ 437z=10473$$ and $x_0$, $y_0$ be a solution of $$19x + 23y = t_0.$$ Then $(x_0,y_0,z_0)$ is a particular solution of $323x+391y+437z=10473$, whereas the general solution is given by $$\begin{cases} x = x_0 - 23k - u_0j\\ y = y_0 + 19k - v_0j\\ z = z_0 + 17j \end{cases}$$ with $j,k\in\mathbb{Z}$.

Then compare your result given by Script.

P.S. Finally, I got the general solution: $$\begin{cases} x = 8 - 23k -23j\\ y = 9 + 19k\\ z = 10 + 17j \end{cases}\tag{*}$$ with $j,k\in\mathbb{Z}$.

Verification that (*) are ALL the solutions of the given linear Diophantine equation. It is easy to check that the particular solution $(x_0,y_0,z_0)=(8,9,10)$ works. Moreover, the related homogeneous equation is $$323(x-x_0)+391(y-y_0)+437(z-z_0)\\=17\cdot 19 (x-x_0)+17\cdot 23(y-y_0)+19\cdot 23 (z-z_0)=0$$ and it follows that $z-z_0$ is a multiple of $17$, i.e. $z = z_0 + 17j$, $y-y_0$ is a multiple of $19$, i.e. $y = y_0 + 19k$, and therefore $$x=x_0-\frac{391(y-y_0)+437(z-z_0)}{323}=x_0-\frac{(17\cdot 19)\cdot 23 k+(19\cdot 23) \cdot 17j}{17\cdot 19}\\=x_0-23k-23j$$ and we are done.

Note that along the same lines, you may show that the method outlined above works in general.


Hint. To mod $17$, $323\equiv0$, $391\equiv0$, $437\equiv12$ and $10473\equiv1$. Hence $z$ must be such that $12z\equiv1\pmod{17}$. Similar constraints can be found on $x$ using mod $23$ and $y$ using mod $19$.