Solving system of equations Mathematica

In summary, the person is trying to solve a system of equations using Mathematica and is looking for a command that will give them a solution in the form of a linear combination of the basis for the kernel. However, the LinearSolve[] command only provides a particular solution. The person is unsure if there is a single command that can give them the desired solution or if they have to use the NullSpace[] command separately. They also mention that the determinant may be zero, which could explain why the solution is in the form of a 3d vector instead of a 4d vector.
  • #1
Mr Davis 97
1,462
44
I am solving the following system of equations (in matrix form):

##\begin{pmatrix} 1 & -2 & -1 & 1 \\ 2 & -3 & 1 & 6 \\ 3 & -5 & 0 & 7 \\ 1 & 0 & 5 & 9 \end{pmatrix}##

I want to solve it using Mathematica, but when I use the command LinearSolve[], I only get back ##\begin{pmatrix} 9 \\ 4 \\ 0 \end{pmatrix}##, which is a particular solution. However, I am looking for how to get an output of something like ##\begin{pmatrix} 9 \\ 4 \\ 0 \end{pmatrix} + t_1\begin{pmatrix} -5 \\ -3 \\ 1 \end{pmatrix}##, where the linear combinations of the basis for the kernel is included. Is there a single command that does this? Or would I have to separately the NullSpace[] command?
 
Physics news on Phys.org
  • #2
Hi Mr Davis:

I know next to nothing about Mathematica, but I would expect it to have a function you could invoke that would invert a matrix for you. Did you look for one to do that?

ADDED
Sorry, I misunderstood your question. Since you got a 3d vector as the solution from a 4d matrix, I am guessing the determinant is zero. I don't understand why the answer would be a 3d vector, so I am at a loss. I would expect, and I am guessing you are looking for, an answer of the form:
V1 + const x V2​
where V1 and V2 are 4d vectors. V1 is a solution to
M x V = V3,​
and V2 is a solution for
M x V = 0.​

I have nothing to suggest about how to approach this using Mathematica.

Regards,
Buzz
 
Last edited:

FAQ: Solving system of equations Mathematica

How can I input a system of equations in Mathematica?

To input a system of equations in Mathematica, you can use the "Solve" function and list out the equations separated by commas. For example, if you have the equations x+y=3 and x-y=1, you can type "Solve[x+y==3, x-y==1]" in the input cell.

Can Mathematica solve systems of equations with multiple variables?

Yes, Mathematica is capable of solving systems of equations with multiple variables. You can input the equations with all the variables included, and Mathematica will solve for the unknown variables.

How do I check the solution to a system of equations in Mathematica?

To check the solution to a system of equations in Mathematica, you can use the "Substitute" function. This function will substitute the solved values into the equations and check if they satisfy the equations. If the output is "True" for all equations, then the solution is correct.

Can Mathematica solve systems of equations with complex numbers?

Yes, Mathematica can solve systems of equations with complex numbers. However, you need to make sure to use the appropriate syntax for complex numbers, such as using "I" for the imaginary unit and parentheses for complex numbers within the equations.

How can I solve a system of differential equations in Mathematica?

To solve a system of differential equations in Mathematica, you can use the "DSolve" function. This function takes in the differential equations and the initial conditions (if any) and outputs the general solution. You can then use the initial conditions to find the specific solution for your system.

Similar threads

Replies
8
Views
3K
Replies
1
Views
2K
Replies
2
Views
1K
Replies
6
Views
780
Replies
2
Views
462
Replies
2
Views
688
Back
Top