Show that these equations are linearly dependent using Mathematica

Click For Summary
SUMMARY

This discussion focuses on demonstrating the linear dependence of equations using Mathematica and SageMath. The user encountered issues with Mathematica returning empty outputs when attempting to solve a system of four equations with three unknowns. It was concluded that the equations are inconsistent, as indicated by the output of the Reduce function returning False. The discussion also highlights the importance of checking the determinant of the matrix formed by the equations to confirm linear independence.

PREREQUISITES
  • Understanding of linear algebra concepts such as linear dependence and independence.
  • Familiarity with Mathematica version 12.3 for solving linear systems.
  • Basic knowledge of SageMath for matrix operations.
  • Experience with matrix determinants and their implications in linear systems.
NEXT STEPS
  • Learn how to use the Reduce function in Mathematica for analyzing linear systems.
  • Explore matrix determinant calculations in SageMath to assess linear independence.
  • Study the implications of inconsistent systems in linear algebra.
  • Investigate methods for identifying redundant equations in overdetermined systems.
USEFUL FOR

Students and educators in mathematics, particularly those studying linear algebra, as well as software developers and data scientists utilizing Mathematica and SageMath for solving linear equations.

Lambda96
Messages
233
Reaction score
77
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
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   Reactions: topsquark and Lambda96
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   Reactions: topsquark, Lambda96 and FactChecker
Try solving <br /> C_1 \mathbf{a} + C_2 \mathbf{b} + C_3 \mathbf{c} + C_4 \mathbf{d} = \mathbf{0}. If \mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d}, 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 C_4 \neq 0 then you have \lambda_i = C_i/C_4.
 
  • Like
Likes   Reactions: topsquark and Lambda96
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   Reactions: topsquark, Lambda96, FactChecker and 1 other person
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   Reactions: FactChecker and Dale
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   Reactions: Lambda96

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 3 ·
Replies
3
Views
4K
Replies
18
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
Replies
5
Views
2K
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K