Question : 1=365r + 1876s ... Find r and s

We have to use Bezout's Identiy to solve this problem.

I have the solution already but there is a part in the solution which i don't understand, is it possible for anyone to explain me that part:

First, finding the G.C.D( which is given but the steps to it using Euclid's Algorithim)

1876=365*5 + 51

365=51*7 + 8

51=8*6 + 3

8=3*2 +2

3=2*1 +1

2=1*2 +0

Therefore the G.C.D of (365, 1876)=1

Now solving for the remainders:

0=2-1*2

1=3-2*1

2=8-3*2

3=51-8*6

8=365-51*7

51=1876- 365*5

and subsituting succesively the remainders into the equation 1=3-2*1, starting with 2:

1=3-2*1

THIS IS WHERE I AM CONFUSED NOW ::::

= 3-(8-3*2) = 3*3-8 ( i dont understand how it equals 3*3-8 ????)

=3(51-8*6)-8=3*51-8*19

.

.

.

.

.

it goes on but i first need to understand how the first step equals 3*3-8 ....if anyone could please explain!!!