Show that these equations are linearly dependent using Mathematica

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
6 replies · 2K views
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.
 
Reply
  • 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.
 
Reply
  • Like
Likes   Reactions: topsquark, Lambda96 and FactChecker
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].
 
Reply
  • 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:
Reply
  • 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 🙃
 
Reply
  • 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.
 
Reply
  • Like
Likes   Reactions: Lambda96