You have to write
$$
1 = 240x+17y
$$
so
$$
240x\equiv 1\pmod{17}
$$
The Euclidean algorithm applied to $240$ and $17$ gives
\begin{align}
\color{red}{240} &= \color{red}{17}\cdot 14 + \color{red}{2} \\
\color{red}{17} &= \color{red}{2}\cdot 8 + \color{red}{1}
\end{align}
The successive remainders are colored red. Now start from the top:
$$
\color{red}{2}=\color{red}{240}-\color{red}{17}\cdot 14
$$
Go one line down:
$$
\color{red}{1}=\color{red}{17}-\color{red}{2}\cdot 8
$$
Substitute the value you have for $\color{red}{2}$:
$$
\color{red}{1}=\color{red}{17}-(\color{red}{240}-\color{red}{17}\cdot 14)\cdot 8
=\color{red}{17}\cdot(1+132)-\color{red}{240}\cdot 8
=\color{red}{240}\cdot(-8)+\color{red}{17}\cdot 133
$$
Thus you can take $x=-8$, or else $x=9$ since $-8\equiv 9\pmod{17}$. Indeed
$$
240\cdot9=2160=17\cdot127+1
$$
or
$$
240\cdot 9\equiv 1\pmod{17}.
$$
Just remember operating on the “red numbers” as if they were letters. Express each remainder in terms of the previous ones and substitute in the equations below the first. Only terms with $\color{red}{240}$ and $\color{red}{17}$ multiplied by integers will remain.
If $\,b,\bar b$ are inverses of $\,a\,$ then $\ b\equiv b(a\bar b)\equiv (ba)\bar b\equiv \bar b\, $ by Congruence Product Rule. We used only commutativity & associativity of products so the proof works in any commutative ring or monoid.
Note $ $ The proof is just a slick way of cancelling $\,\color{#c00}a\,$ from $\,\color{#c00}ab\equiv 1\equiv \color{#c00}a\bar b\,$ by scaling by $\,\color{#c00}a^{-1},\,$ yielding $\,b\equiv \bar b.\,$ Hence we see that the uniqueness of inverses is simply a special case of the general fact that invertible elements are cancellable, via scaling by the inverse.
Proofs like this can often be discovered by a general method of "overlapping" equations to find a term that both equations apply to (above the overalapped term is $\,ba\bar b\,$ which can be reduced by both rules $\,ab\to 1,\ a\bar b\to 1).\, $ Below is another example with further explanation.
Below I will explain a general way to discover a simpler proof (vs. pulling it out of a hat like magic). The key idea is very simple: one can discover consequences of identities (axioms) by "overlapping" them: $ $looking for a "unified" term that they both apply to. Let's try that to prove the uniqueness of additive identity elements. Suppose that $\,0\,$ and $\,0'$ are both additive identities. This means that
$$\begin{eqnarray}
x = && \color{#0a0}0 + \color{#c00}x\\
&& \color{#0a0}y + \color{#c00}{0'} = y\\
\hline
\Rightarrow\ \ 0' = && 0 + 0' = 0\end{eqnarray}$$
where we chose the values of the specialization $\,\color{#0a0}{y=0},\ \color{#c00}{x = 0'}\,$ in order unify $\,0+x\,$ with $\,y+0', \,$ yielding the "unified" term $\,0+0'\,$ that both axioms apply to. Applying both axioms to the unified term we can rewrite it in two different ways, deducing the new consequence $\,0' = 0.\,$ Presto!
This is a very widely applicable method of deriving consequences of axioms, i.e. by "unifying" or "overlapping" terms of both so that both axioms apply, yielding a rewriting of the term in two different ways (e.g. another example). In fact in some cases it can be used to algorithmically derive all of the consequences of the axioms, so yielding algorithms for deciding equality, e.g. see the Knuth-Bendix equational completion algorithm and the Grobner basis algorithm, and see George Bergman's classic paper The Diamond Lemma in Ring Theory.
Best Answer
It's correct. Don't worry modular arithmetic is easy and is meant to be easy.
$a \equiv b \mod n \iff n\mid a-b$.
So $a + x \equiv b + x\pmod n \iff n\mid (a+x) - (b+x)$ but $(a+x) - (b+x) = a-b$.
So $a + x \equiv b + x \pmod n \iff a \equiv b \pmod n$.
So... you can always add to the same thing to both sides. Just liked you'd hope you could.
So $a + x \equiv 0\pmod n \iff$
$x \equiv - a \pmod n$.
And if you don't like negatives as $n \equiv 0 \pmod n$ (Because $n\mid n-0= n$)
We can add $n$.
$x \equiv -a \pmod n$ so
$x\equiv x + 0 \equiv -a + n \equiv n-a \pmod {n}$.
(That works because $n \equiv 0 \pmod n \implies n + (-a) \equiv 0 + (-a) \pmod n$).
It's meant to be easy.
....
So $13 + x \equiv 0 \pmod {8}$ so
$5 + x \equiv 0 \pmod 8$ so
$x \equiv -5 \equiv -5 + 8 \equiv 3\pmod 8$.
That's all you have to do and that is enough.