Show that these equations are linearly dependent using Mathematica

  • #1
Lambda96
158
59
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

1. How can I determine if these equations are linearly dependent using Mathematica?

To determine if a set of equations are linearly dependent using Mathematica, you can create a matrix from the coefficients of the equations and then use the RowReduce function to check if the matrix has any rows of zeros. If there are rows of zeros, then the equations are linearly dependent.

2. Can you provide an example of how to use Mathematica to show linear dependence of equations?

Sure! Here's an example code snippet in Mathematica:eqns = {2x + y == 3, 4x - 2y == 6};matrix = CoefficientArrays[eqns, {x, y}][[2]];RowReduce[matrix]

3. What does it mean for equations to be linearly dependent?

Equations are considered linearly dependent if one equation can be expressed as a linear combination of the other equations in the set. This implies that the equations are not all independent and provide redundant information.

4. Are there any specific functions in Mathematica that are useful for analyzing linear dependence of equations?

Yes, Mathematica provides useful functions such as CoefficientArrays to extract the coefficients of the equations and RowReduce to perform row operations on the coefficient matrix to determine linear dependence.

5. Is it necessary to use Mathematica to show linear dependence of equations?

No, it is not necessary to use Mathematica specifically. You can also manually perform row operations on the coefficient matrix to determine linear dependence. However, Mathematica can streamline the process and provide accurate results efficiently.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
Replies
3
Views
1K
  • Precalculus Mathematics Homework Help
Replies
5
Views
991
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
265
Replies
2
Views
1K
  • Precalculus Mathematics Homework Help
Replies
1
Views
730
  • Advanced Physics Homework Help
Replies
5
Views
788
Replies
2
Views
610
  • Advanced Physics Homework Help
Replies
6
Views
936
  • Calculus and Beyond Homework Help
Replies
5
Views
491
Back
Top