Added comments to describe the first function.
More comments, variables renamed for ease of understanding.
Variables renamed.
Use "solve()" for the inversion. More comments.
Removed empty line.