The following underdetermined equation set was analyzed in Example 6.4-2. There it was shown that an infinite number of solutions exists. Use the pinv and the rref commands to obtain solutions.

2x-4y+5z=-4
-4x – 2} + 3z = 4
2x + 6)’ – 8;: == 0

• Solution
First use the p i nv command. The MATLAB session follows.
»A [2,-4,5;-4,-2,3;2,6,-8];
»b [-4;4;0];
»x pinv(A)*b
x
-1.2148
0.2074
-0.1481
Thus the pseudoinverse method gives the solution: x = -1.2148, )’ = 0.2074, z = -0.1481. This solution is valid, but it is not the general solution.
To obtain the general solution, we can use the rre f command. The current MATLAB session continues as follows.
»rref ([A b])
ans =

We can easily solve these expressions for x and y in terms of z as follows: x = 0,1z – 1.2 and y = l.3z +0.4. This result is the general solution to the problem, where z is taken to be the arbitrary variable