Solving Systems of Equations using Cramer's Rule Create an algorithm that uses Cramer's Rule (with determinants of matrices) to solve for the solutions of a system of linear equations. The code should work for an "n" number of variables. 

You may use whatever data structure you want to hold the matrix and return the result

Note: Also, consider that a possible system can have no solutions and may have infinitely many solutions :), so, your solution should take account of this... 

If this is the case, just print out or return "none" or "infinitely many". 

Since this is code golf, smallest code wins...

EDIT: To make this more challenging, you cannot use a language's built-in matrix operations libraries. 

Also, your algorithm DOES NOT have to deal how to get the input, just how to process the input and return the correct output. As said before, you can store this input in whatever structure.
Mathematica 40

Setting up the problem in your reference link:  



s = {{2, 1, 1}, {1, -1, -1}, {1, 1, 1}};
r = {3, 0, 0};


The algorithm (spaces not needed):

i = 1; (a = s; a[[All, i++]] = r; Det@a/Det@s) &amp; /@ r


result:

{1, -2, 3}


If the system has infinite solutions it returns Indeterminate or ComplexInfinite

Please note that Mathematica can solve linear systems natively. Among other possible ways you could use:

s~LinearSolve~r


or

Solve[s.{x,y,z}==r]