Solve a Matrix-vector equation with Solve instead of LinearSolve?

Hey guys, I’m currently stuck on this one task where I’m trying to calculate how many solutions the equation A * B = X has, where A is a 3x3 matrix, and B is a 1x3 vector. I’m supposed to use Solve as a command, but I can’t get it to work unless I’m using LinearSolve. So far, I’ve got the code:

LinearSolve[( {
   {1, 1, -2},
   {3, 4, -3},
   {1, 2, 1}} ),
   {1, 1, -1}]

Where the (1,1,1) is my vector. This gave me the correct solution, but I’m supposed to use the Solve command instead, and I have no idea how to. I’d be very greatful if you could help me out with this.

Solve wants equations using explicit variables. That can be done along the lines below.

mat = {{1, 1, -2}, {3, 4, -3}, {1, 2, 1}};
b = {1, 1, -1};
vars = Array[x, 3];

In[30]:= mat.vars == b

(* Out[30]= {x[1] + x[2] - 2 x[3], 3 x[1] + 4 x[2] - 3 x[3], 
  x[1] + 2 x[2] + x[3]} == {1, 1, -1} *)

What specifically is this command for? i don’t quite understand what it means.

vars = Array[x, 3];

search.gif

search-2.gif

Jhn,

You can find all Wolfram Language functions documented online at:

and in-product (e.g in Mathematica) by pressing F1 and searching for the relevant function.

You can also select any function and press F1 to get usage help on that function.

Here is a nice video on solving equations in the Wolfram Language:

Another one, with really nice background music!

Here is another quick video!

Hope this helps you!