Chinese remainder theorem :Algebraic solution I need help in a question:
It is required to find the smallest $4$-digit number that when divided by $12,15$, and $18$ leaves remainders $8,11$, and $14$ respectively. Here's how I've attempted:
Let the number be $a$, then $$a=12p+8 = 15q+11 = 18r+14$$
Hence, $p=(5q+1)/2$ and $r=(5q-1)/6$
So, $a=15q+11$
Now if I put $q=67$, $a=1016$ (wrong answer because $r$ is not an integer) .
So where did I go wrong in the algebraic method?

$$a = 12p+8 = 15q+11 = 18r+14$$
You should break these down into linear expressions with prime-power coefficients.
$$a = 12p+8 \implies a =
\left\{ \begin{array}{c}
   4(3p+2) \\
   3(4p+2)+2
\end{array}
\right \}$$
$$a = 15q+11 \implies a =
\left\{ \begin{array}{c}
   3(5q+3)+2 \\
   5(3q+2)+1
\end{array}
\right \}$$
$$a = 18r+14 \implies a =
\left\{ \begin{array}{c}
   2(9r+7) \\
   9(2r+1)+5
\end{array}
\right \}$$

Some of these can be combined.
$$a =
\left\{ \begin{array}{c}
   4(3p+2) \\
   2(9r+7)
\end{array}
\right \}
\implies a = 4u$$
$$a =
\left\{ \begin{array}{c}
   3(4p+2)+2 \\
   3(5q+3)+2 \\
   9(2r+1)+5
\end{array}
\right \}
\implies a = 9v+5$$
$$a=5(3q+2)+1 \implies a = 5w+1$

$$\left\{ \begin{array}{l}
   a=4u \\
   a=9v+5 \\
   a=5w+1
\end{array}
\right \}
\implies
\left\{ \begin{array}{l}
   45a=180u \\
   20a=180v+100 \\
   36a=180w+36
\end{array}
\right \}
\implies
\left\{ \begin{array}{rcl}
   45a &=& 180u \\
   -80a &=& 180(-4v)-400 \\
   36a &=& 180w+36
\end{array}
\right \}
$$
Adding the three equations, we get
$$ n= 180x + 176$$
Since the smallest $3$-digit number is $100$, the smallest $3$-digit number of the form $ n= 180x + 176$ must be between $100$ and $100+180-1=279$
\begin{array}{c}
   100 &\le &180x+176 &\le &279 \\
   -76 &\le &180x     &\le &103 \\
   -\dfrac{76}{180} &\le &180x     &\le &\dfrac{103}{180} \\
   0 &\le &180x     &\lt &1 \\
   &&x &= &0
\end{array}
So $n=176$
