Extended euclidean algorithm So I am trying to figure this out.
And for one of the problem the question is x*41= 1 (mod 99)
And the answer lists
 x | 41x mod 99
 0    99
 1    41
 -2   17
 5    7
 -12  3
 29   1

And conclude x=29
How did they get this value(can someone explain)? To better put, how do you calculate this?

A better table would probably be the following
$$\begin{matrix}
99 & 41\\
\hline
1 & 0 & | & 99\\
0 & 1 & | & 41\\
1 & -2 & | & 17\\
-2 & 5 & | & 7\\
5 & -12 & | & 3\\
-12 & 29 & | & 1
\end{matrix}$$
where each line
$$\begin{matrix}
a & b & | & r\\
\end{matrix}$$
means
$$
99 \cdot a + 41 \cdot b = r,
$$
and you go from two consecutive lines
$$\begin{matrix}
a_{1} & b_{1} & | & r_{1}\\
a_{2} & b_{2} & | & r_{2}\\
\end{matrix}$$
to the next by doing Euclidean division of $r_{1}$ by $r_{2}$,
$r_{1} = r_{2} q + r$, with $0 \le r < r_{2}$, and then taking as the next line
$$\begin{matrix}
a_{1} - a_{2} q & b_{1} - b_{2} q & | & r,\\
\end{matrix}$$
which satisfies indeed
$$
99 \cdot (a_{1} - a_{2} q) + 41 \cdot (b_{1} - b_{2} q)
=
99 a_{1} + 41 \ b_{1} 
-
(99 \cdot a_{2}  + 41 b_{2}) q
=
r_{1} - r_{2} q = r.
$$
So the last column yields the remainders of the Euclidean algorithm. In your table, the first column is omitted, since the required inverse is the last element in the second column. I have left it in, because the full scheme provides the extra Bézout information
$$
99 \cdot (-12) + 41 \cdot 29 = 1,
$$
from which you get
$$
41 \cdot 29 \equiv 1 \pmod{99}.
$$
