The phi function is definitely worth learning! However, my approach to solving this equation is definitely not the most practical; the only reason I used it was because it was the first method that popped into my head and I had the tools available to compute it.
I imagine that Nate's approach is closely related to the approach using the extended euclidean algorithm. When you use the extended euclidean algorithm to compute gcd(m, n), it gives you integers u and v such that:
um + vn = gcd(m, n)
If we are given that x is relatively prime to n, we know that gcd(x, n) = 1. If we apply the extended euclidean algorithm, we get integers u and v such that:
ux + vn = 1
Now, if we reduce this equation mod n, we get
ux = 1 (mod n)
So this is how we can compute inverses with the extended euclidean algorithm.
The trick to the extended euclidean algorithm is to remember the steps you performed while computing the gcd. Allow me to demonstrate:
We start wtih gcd(37, 109)
The first step of the euclidean algorithm for computing this gcd is to subtract from 109 a multiple of 37, preferably the largest multiple of 37 that is less than 109, which is 74. So, we have:
gcd(37, 109) = gcd(37, 109 - 74) = gcd(37, 35)
But we need to keep track of the operations we performed, so we also note that:
35 = 109 - 2 * 37
Then we subtract 35 from the left side to get:
gcd(37, 35) = gcd(2, 35)
And we note that
2 = 37 - 35 = 37 - (109 - 2 * 37) = 37 - 109 + 2 * 37 = 3 * 37 - 109
Finally, we subract 34 fom 35 to get:
gcd(2, 35) = gcd(2, 1) = 1
And we note that
1 = 35 - 2 * 17 = (109 - 2 * 37) - 17 * (3 * 37 - 109) = 18 * 109 - 53 * 37
So now we know that:
1 = (-53) * 37 = 56 * 37 (mod 109)
There are much better ways of doing this bookkeeping, but I just wanted to demonstrate the idea.