Show that these equations are linearly dependent using Mathematica

In summary, to show that the given equations are linearly dependent using Mathematica, one would typically form a matrix with the coefficients of the equations, then compute the determinant. If the determinant is zero, it indicates that the equations are linearly dependent. Alternatively, one can use the `LinearDependence` function in Mathematica to directly check for linear dependence among the set of equations.
  • #1
Lambda96
223
75
Thread moved from the technical forums to the schoolwork forums
TL;DR Summary: solve linear systems of equations

Hi,

I am supposed to solve the following problem with Mathematica

Bildschirmfoto 2023-10-31 um 14.30.58.png

This is the tutorial we received on how to solve linear systems with Mathematica:
Bildschirmfoto 2023-10-31 um 14.31.49.png

I then tried the whole thing for the task, but unfortunately Mathematica doesn't give me any values, just an empty output. Unfortunately, I do not know what I did wrong, because I followed the instructions 1-to-1.

Bildschirmfoto 2023-10-31 um 14.37.50.png
 
Physics news on Phys.org
  • #2
You have four equations and three unknowns. Are you sure that there is a solution?

You could remove one equation and see if the matrix has a non-zero determinant. If so, solve those equations and see if it also solves the equation that you removed.
 
  • Like
Likes topsquark and Lambda96
  • #3
There isn't a solution. Mathematica is correctly identifying the fact that there is no solution. You can also use Reduce instead of Solve, and the result of Reduce is False, indicating that the equation is inconsistent.
 
  • Like
Likes topsquark, Lambda96 and FactChecker
  • #4
Try solving [tex]
C_1 \mathbf{a} + C_2 \mathbf{b} + C_3 \mathbf{c} + C_4 \mathbf{d} = \mathbf{0}.[/tex] If [itex]\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d}[/itex], are linearly independent then the only solution is C_1=C_2=C_3=C_4=0[/itex]; if there is a non-zero solution with [itex]C_4 \neq 0[/itex] then you have [itex]\lambda_i = C_i/C_4[/itex].
 
  • Like
Likes topsquark and Lambda96
  • #5
Thread solved. Just for the fun of it I tried the exercise on https://sagecell.sagemath.org/
and with trial and error found the incantation

Code:
a= vector([10,-4,56,20])
b=vector([-4,7,10,-45])
c=vector([24,-8,3,1])
d=vector([59,1,4,-6])

# declaring a matrix is the other way
aa = matrix (QQ,[[10,-4,24],[-4,7,-8],[56,10,3],[20,-45,1]]);aa

# test: a vector that gives a solution for Ax = e
e=a+2*b+3*c;e
aa.solve_right(e)

# now for real
#aa.solve_right(d)

that evaluates to
Code:
(1, 2, 3)

and when I remove the # in front of the last line aa.solve_right(d), the result when 'evaluate' is pressed:
Code:
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In [1], line 14
     11 aa.solve_right(e)
     13 # now for real
---> 14 aa.solve_right(d)

File /home/sc_serv/sage/src/sage/matrix/matrix2.pyx:913, in sage.matrix.matrix2.Matrix.solve_right()
    911
    912         if not self.is_square():
--> 913             X = self._solve_right_general(C, check=check)
    914         else:
    915             try:

File /home/sc_serv/sage/src/sage/matrix/matrix2.pyx:1036, in sage.matrix.matrix2.Matrix._solve_right_general()
   1034     # Have to check that we actually solved the equation.
   1035     if self*X != B:
-> 1036         raise ValueError("matrix equation has no solutions")
   1037 return X
   1038

ValueError: matrix equation has no solutions

which isn't the most user-friendly thing I can think of, but the last line answers the question ...
Disclaimer: I know next to nothing about mathematica and python (old Fortran addict) but am really impressed by these powerful modern tools !

##\ ##
 
Last edited:
  • Like
Likes topsquark, Lambda96, FactChecker and 1 other person
  • #6
Thanks FactChecker, Dale, pasmith and BvU for your help 👍👍👍👍 I just got the message from my lecturer that he chose the vector d incorrectly, which is why the vectors are so linearly independent and why the equation has no solution 🙃
 
  • Like
Likes FactChecker and Dale
  • #7
Lambda96 said:
which is why the vectors are so linearly independent and why the equation has no solution 🙃
To be more exact, just like the simple example: x=1; x=2, the vectors are linearly dependent but the equations are inconsistent. When there are more equations than there are unknowns, either the equations are redundant and have a solution or they are inconsistent and do not have a solution. x=1; 2x=2 would be redundant. x=1; x=2 is inconsistent.
PS. If there are several more equations than unknowns, then some may be redundant and others may be inconsistent.
 
  • Like
Likes Lambda96

FAQ: Show that these equations are linearly dependent using Mathematica

How do I define a set of equations in Mathematica?

In Mathematica, you can define a set of equations using the `==` operator. For example, if you have the equations x + y == 1 and 2x + 2y == 2, you can define them as `eqns = {x + y == 1, 2x + 2y == 2};`.

What function do I use to check for linear dependence in Mathematica?

You can use the `LinearDependence` function to check for linear dependence. This function is part of the `LinearAlgebra` package. You can load the package using `Needs["LinearAlgebra`"]` and then use `LinearDependence[{eqns}]` to check if the equations are linearly dependent.

How can I find the coefficients of the equations in Mathematica?

You can use the `CoefficientArrays` function to extract the coefficients of the variables in your equations. For example, `CoefficientArrays[eqns, {x, y}]` will give you the coefficient matrix of the equations with respect to the variables x and y.

What indicates that equations are linearly dependent in Mathematica?

In Mathematica, if the rank of the coefficient matrix is less than the number of variables, the equations are linearly dependent. You can find the rank using the `MatrixRank` function. For example, `MatrixRank[CoefficientArrays[eqns, {x, y}][[2]]]` will give you the rank of the coefficient matrix.

Can I visualize the linear dependence of equations in Mathematica?

Yes, you can visualize the linear dependence by plotting the equations. For instance, you can use `Plot` or `ContourPlot` to see if the lines or surfaces represented by the equations overlap, which indicates linear dependence. For example, `ContourPlot[{x + y == 1, 2x + 2y == 2}, {x, -10, 10}, {y, -10, 10}]` will show the plots of the two equations.

Similar threads

Replies
3
Views
2K
Replies
1
Views
2K
Replies
4
Views
1K
Replies
6
Views
4K
Replies
1
Views
1K
Back
Top