Multiplicative inverse of $n+1$ modulo $n^2$ [duplicate]

Find the multiplicative inverse of $n+1$ modulo $n^2$ , where $n$ is any integer greater than $1$

We have to find $z$ such that $(n+1)z=1\pmod{n^2}$ $$ n^2-k(n+1)=n^2-kn-k=1\implies n^2-kn-(k+1)=0\\ \implies n=k+1\text{ or }-1\implies \boxed{k=n-1}\\ n^2-(n-1)(n+1)=1 $$ For $a>b$ using Euclid's algorithm we can conclude that $\gcd(a,b)=\gcd(a-b,b)$. $$ \gcd(n^2,n+1)=\gcd(n^2-(n+1),n+1)=\gcd(n^2-2(n+1),n+1)=\cdots=\gcd(n^2-(n-1)(n+1),n+1)=\gcd(1,n+1)=1 $$ $\implies $ inverse exists

But how do I proceed further? Can we follow the same steps for a particular integer ?

For example if it were to find $27$ modulo $4$ then

$27b=1\pmod4$ and $\gcd(27,4=1)\implies $ inverse exists

$$ 27=6\times 4+3\\ 4=1\times 3+3 $$ $$ 3=27-6\times 4\\ 1=4-1\times 3 $$ $$ 1-4-1\times 3=4-1(27-6\times 4)=4-1\times 27+6\times 4\\ 1=7\times 4-1\times 27\\ 27\times -1=-7\times 4+1\\ 27\times -1=1\pmod 4 $$


Since $(n+1)(n-1) \equiv (-1) \pmod{n^2}$ and since $(-1)^2 \equiv 1\pmod{n^2}$, you have that

$[(n+1)(n-1)]^2 \equiv 1\pmod{n^2}.$

Therefore, the inverse of $(n+1)$ is $[(n+1)(n-1)^2]$.

This inverse simplifies to $(-1)(n-1) = (1 - n)$.