So I'm writing an essay about RSA encryption, and there is one step that I'm currently having some trouble with:

Determine d (using modular arithmetic) which satisfies the congruence relation :

where d is the only unknown

It says that this is done with the extended Euclidean algorithm and with the modular multiplicative inverse. Here is a link to how this is done, and I understand it all until it all until the last step, where it says "a and m given, x the inverse, and q an integer multiple that will be discarded". What I don't understand is how this gives you the d value (in the initial equation). Also from what I gather, you would take the inverse of a ("x the inverse"?) and you discard q, however this doesn't give me a correct answer... Can anyone help me with this?

Also another question regarding modulo; if you have a large number such as 193284719827 mod (19), is there any way to find out what the value of it is other than subtracting multiples of 19 from the initial value?

Thanks

-Chris

By the way, sorry if this is in the wrong forum, I just figured that since it was the math of the encryption that I need help with and not the encryption itself that this is where it would go.