Solving Linear Congruences

## **Problem**

Solve the following linear congruences.

**Part 1:**

9
x
≡
12

(
mod

15
)

{\displaystyle 9x \equiv 12 \pmod{15} }

**Part 2:**

7
x
≡
4

(
mod

12
)

{\displaystyle 7x \equiv 4 \pmod{12} }

## **Solution**

**Part 1**

Note that

gcd
(
9
,
15
# )
3

{\displaystyle \gcd(9,15) = 3}

 and 3 divides 12. This means there are three incongruent solutions modulo 15. These three solutions are determined by finding a particular solution and then adding the appropriate multiples of 5. The multiples of 5 comes from dividing the modulus 15 by 3.

To find a particular solution, consider the Diophantine equation

9
x
−
15
# y

{\displaystyle 9x - 15 y = 12.}

Applying the Euclidean algorithm, we find

15

=
9
⋅
1
6

9

=
6
⋅
1
3

6

=
3
⋅
2

{\displaystyle \begin{align}
15 &= 9 \cdot 1 + 6 \\
9 &= 6 \cdot 1 + 3 \\
6 &= 3 \cdot 2
\end{align}}

which means

3

=
9
−
6
⋅
1

3

=
9
−
(
15
−
9
⋅
1
)

3

=
9
⋅
2
−

{\displaystyle \begin{align}
3 &= 9 - 6 \cdot 1 \\
3 &= 9 - (15 - 9 \cdot 1)\\
3 &= 9 \cdot 2 - 15.
\end{align}}

Scaling the final result by 4 and rearranging gives

9
⋅
8
−
15
⋅
# 4

{\displaystyle 9\cdot 8 - 15 \cdot 4 = 12.}

Thus, we get a particular solution

(

x
0

,

y
0

# )
(
8
,
4
)

{\displaystyle (x\_0, y\_0) = (8,4)}

 to the Diophantine equation.

The three solutions include

x
≡

x
0

(
mod

15
)

{\displaystyle x \equiv x\_0 \pmod{15} }

,

x
≡

x
0

5

(
mod

15
)

{\displaystyle x \equiv x\_0 + 5 \pmod{15} }

, and

x
≡

x
0

10

(
mod

15
)

{\displaystyle x \equiv x\_0 + 10 \pmod{15}
}

:

x

≡
8

(
mod

15
)

x

≡
13

(
mod

15
)

x

≡
18

(
mod

15
)
.

{\displaystyle \begin{align}
x &\equiv 8 \pmod{15} \\
x &\equiv 13 \pmod{15}\\
x &\equiv 18 \pmod{15}.
\end{align}}

Therefore, the solutions are

x

≡
8

(
mod

15
)

x

≡
13

(
mod

15
)

x

≡
3

(
mod

15
)
.

{\displaystyle \begin{align}
x &\equiv 8 \pmod{15} \\
x &\equiv 13 \pmod{15}\\
x &\equiv 3 \pmod{15}.
\end{align}}

**Part 2**

Since

gcd
(
7
,
12
# )
1

{\displaystyle \gcd(7,12) = 1}

, there exists a unique solution modulo 12. Consider the Diophantine equation

7
x
−
12
# y

{\displaystyle 7x - 12 y = 4.}

Applying the Euclidean algorithm, we find

12

=
7
⋅
1
5

7

=
5
⋅
1
2

5

=
2
⋅
2
1

2

=
1
⋅
2

{\displaystyle \begin{align}
12 &= 7 \cdot 1 + 5 \\
7 &= 5 \cdot 1 + 2 \\
5 &= 2 \cdot 2 + 1 \\
2 &= 1 \cdot 2
\end{align}}

which means

1

=
5
−
2
⋅
2

1

=
5
−
(
7
−
5
⋅
1
)
⋅
2

1

=
5
⋅
3
−
2
⋅
7

1

=
(
12
−
7
⋅
1
)
⋅
3
−
2
⋅
7

1

=
12
⋅
3
−
5
⋅

{\displaystyle \begin{align}
1 &= 5 - 2 \cdot 2 \\
1 &= 5 - (7 - 5 \cdot 1) \cdot 2\\
1 &= 5 \cdot 3 - 2 \cdot 7 \\
1 &= (12 - 7 \cdot 1) \cdot 3 - 2 \cdot 7 \\
1 &= 12 \cdot 3 - 5 \cdot 7.
\end{align}}

Scaling the final result by 4 and rearranging gives

7
⋅
(
−
20
)
−
12
⋅
(
−
12
# )

{\displaystyle 7\cdot (-20) - 12 \cdot (-12) = 4.}

Thus, we get a particular solution

(

x
0

,

y
0

# )
(
−
20
,
−
12
)

{\displaystyle (x\_0, y\_0) = (-20,-12)}

 to the Diophantine equation

7
⋅
(
−
20
)
−
12
⋅
(
−
12
# )

{\displaystyle 7\cdot (-20) - 12 \cdot (-12) = 4.}

The solution is thus

x
≡
−
20

(
mod

12
)

{\displaystyle x \equiv -20 \pmod{12}}

or

x
≡
4

(
mod

12
)
.

{\displaystyle x \equiv 4 \pmod{12}.}