Solve Linear Diophantine $12x+18y = 54$ What is asked?
As the title suggests I'm trying to solve a very simple Linear Diophantine Equation: $$12x + 18y = 54$$
Also find an expression for all integer solutions
What have I done?


*

*Firstly, I know that $ax+by = c$ has a solution $\iff$ gcd$(a,b \space | \space c)$

*Secondly, I need to compute the gcd $ (18,12) = 6 $ 


$$18 = 1 \cdot 12 + 6$$
$$12 = 2 \cdot 6 + 0$$
Therefore, gcd(18,12) = 6


*

*Does 6 | 54? Yes. Therefore the equation has integral solutions.

*Okay, all good so far. But it's the next stage that sort of stumps me.


So we can rearrange to get: $$6 = 18 - (1 \cdot 12)$$
Now do I multiply through 9? Whats the next step? I also need to do a generalised form for all integers. 
I have seen this thread How to find solutions of linear Diophantine ax + by = c?, and it is very helpful but every time I come up with a value for $x$ and $y$ it always makes the LHS = 0. But it obviously needs to = 54.
$$\text{Thank you!}$$
 A: Another way is to simplify to
$$2x+3y=9$$
Modulo 3, $$2x\equiv 0\pmod 3\implies x\equiv 0 \pmod 3\implies x:=3m$$ and modulo 2 $$y \equiv 1 \pmod 2 \implies y:=2n+1$$
$$6m+3(2n+1)=9=6(m+n)+3\implies m+n=1\implies m=1-n$$
Hence, $$x=3-3n,y=2n+1$$ for all integral $n$ is the family of solutions.
A: You've pretty much got it, you just need to equate coefficients with the Diophantine equation, so the multiplier of 12 becomes $x$ and likewise, the multiplier of 18 becomes $y$


*$6=1\times18-1\times12$  


*$54=9\times18-9\times12$ (multiplying by 9) 

$ \Rightarrow x=-9, y=9$ (equating coefficients)
that's your solution
A: First you simplify.
$$12x + 18y = 54 \iff 2x + 3y = 9$$
Next you find a solution. 
$$(x_0,y_0) = (0, 3)$$
I found that solution by seeing that $3 \mid 9$ and took advantage of that by letting $x=0$. Another method is to solve for, say, $x$: $\quad x=\dfrac{9-3y}{2}$. So we need $9-3y \equiv 0 \pmod 2$ which simplifies to $y \equiv 1 \pmod 2$. Then  $y=1$ will give us $$(x_0, y_0)=(3, 1)$$.
There is a formula for the general solution that I always forget. This is what I do.
\begin{align}
   2x + 3y &= 9 \\
   2x_0 + 3y_0 &= 9\\
\hline
   2(x-x_0) + 3(y-y_0) &= 0 \\
   2(x-x_0) &= -3(y-y_0)
\end{align}
Clearly $x-x_0$ needs to be a multiple of $3$, lets say $x-x_0 = 3t$
Substituting and solving, you get
$$(x,y) = (x_0 + 3t, y_0-2t)$$
So $$(x,y) = (3t, 3-2t)$$ is one solution and $$(x,y) = (3 + 3t, 1-2t)$$ is another solution. Either one will work.
