# Linear Algebra/Topic: Computer Algebra Systems/Solutions

## Solutions

Answers for this Topic use Maple as the computer algebra system. In particular, all of these were tested on Maple V running under MS-DOS NT version 4.0. (On all of them, the preliminary command to load the linear algebra package along with Maple's responses to the Enter key, have been omitted.) Other systems have similar commands.

Problem 1

Use the computer to solve the two problems that opened this chapter.

1. This is the Statics problem.
${\begin{array}{rl}40h+15c&=100\\25c&=50+50h\end{array}}$
2. This is the Chemistry problem.
${\begin{array}{rl}7h&=7j\\8h+1i&=5j+2k\\1i&=3j\\3i&=6j+1k\end{array}}$
1. The commands
> A:=array( [[40,15],
[-50,25]] );
> u:=array([100,50]);
> linsolve(A,u);

yield the answer $[1,4]$ .
2. Here there is a free variable:
> A:=array( [[7,0,-7,0],
[8,1,-5,2],
[0,1,-3,0],
[0,3,-6,-1]] );
> u:=array([0,0,0,0]);
> linsolve(A,u);

prompts the reply $[\_t_{1},3\_t_{1},\_t_{1},3\_t_{1}]$ .
Problem 2

Use the computer to solve these systems from the first subsection, or conclude "many solutions" or "no solutions".

1. ${\begin{array}{*{2}{rc}r}2x&+&2y&=&5\\x&-&4y&=&0\end{array}}$
2. ${\begin{array}{*{2}{rc}r}-x&+&y&=&1\\x&+&y&=&2\end{array}}$
3. ${\begin{array}{*{3}{rc}r}x&-&3y&+&z&=&1\\x&+&y&+&2z&=&14\end{array}}$
4. ${\begin{array}{*{2}{rc}r}-x&-&y&=&1\\-3x&-&3y&=&2\end{array}}$
5. ${\begin{array}{*{3}{rc}r}&&4y&+&z&=&20\\2x&-&2y&+&z&=&0\\x&&&+&z&=&5\\x&+&y&-&z&=&10\end{array}}$
6. ${\begin{array}{*{4}{rc}r}2x&&&+&z&+&w&=&5\\&&y&&&-&w&=&-1\\3x&&&-&z&-&w&=&0\\4x&+&y&+&2z&+&w&=&9\end{array}}$

These are easy to type in. For instance, the first

> A:=array( [[2,2],
[1,-4]] );
> u:=array([5,0]);
> linsolve(A,u);

gives the expected answer of $[2,1/2]$ . The others are entered similarly.

1. The answer is $x=2$  and $y=1/2$ .
2. The answer is $x=1/2$  and $y=3/2$ .
3. This system has infinitely many solutions. In the first subsection, with $z$  as a parameter, we got $x=(43-7z)/4$  and $y=(13-z)/4$ . Maple responds with $[-12+7\_t_{1},\_t_{1},13-4\_t_{1}]$ , for some reason preferring $y$  as a parameter.
4. There is no solution to this system. When the array $A$  and vector $u$  are given to Maple and it is asked to linsolve(A,u), it returns no result at all, that is, it responds with no solutions.
5. The solutions is $(x,y,z)=(5,5,0)$ .
6. There are many solutions. Maple gives $[1,-1+\_t_{1},3-\_t_{1},\_t_{1}]$ .
Problem 3

Use the computer to solve these systems from the second subsection.

1. ${\begin{array}{*{2}{rc}r}3x&+&6y&=&18\\x&+&2y&=&6\end{array}}$
2. ${\begin{array}{*{2}{rc}r}x&+&y&=&1\\x&-&y&=&-1\end{array}}$
3. ${\begin{array}{*{3}{rc}r}x_{1}&&&+&x_{3}&=&4\\x_{1}&-&x_{2}&+&2x_{3}&=&5\\4x_{1}&-&x_{2}&+&5x_{3}&=&17\end{array}}$
4. ${\begin{array}{*{3}{rc}r}2a&+&b&-&c&=&2\\2a&&&+&c&=&3\\a&-&b&&&=&0\end{array}}$
5. ${\begin{array}{*{4}{rc}r}x&+&2y&-&z&&&=&3\\2x&+&y&&&+&w&=&4\\x&-&y&+&z&+&w&=&1\end{array}}$
6. ${\begin{array}{*{4}{rc}r}x&&&+&z&+&w&=&4\\2x&+&y&&&-&w&=&2\\3x&+&y&+&z&&&=&7\end{array}}$

As with the prior question, entering these is easy.

1. This system has infinitely many solutions. In the second subsection we gave the solution set as
$\{{\begin{pmatrix}6\\0\end{pmatrix}}+{\begin{pmatrix}-2\\1\end{pmatrix}}y\,{\big |}\,y\in \mathbb {R} \}$
and Maple responds with $[6-2\_t_{1},\_t_{1}]$ .
2. The solution set has only one member
$\{{\begin{pmatrix}0\\1\end{pmatrix}}\}$
and Maple has no trouble finding it $[0,1]$ .
3. This system's solution set is infinite
$\{{\begin{pmatrix}4\\-1\\0\end{pmatrix}}+{\begin{pmatrix}-1\\1\\1\end{pmatrix}}x_{3}\,{\big |}\,x_{3}\in \mathbb {R} \}$
and Maple gives $[\_t_{1},-\_t_{1}+3,-\_t_{1}+4]$ .
4. There is a unique solution
$\{{\begin{pmatrix}1\\1\\1\end{pmatrix}}\}$
and Maple gives $[1,1,1]$ .
5. This system has infinitely many solutions; in the second subsection we described the solution set with two parameters
$\{{\begin{pmatrix}5/3\\2/3\\0\\0\end{pmatrix}}+{\begin{pmatrix}-1/3\\2/3\\1\\0\end{pmatrix}}z+{\begin{pmatrix}-2/3\\1/3\\0\\1\end{pmatrix}}w\,{\big |}\,z,w\in \mathbb {R} \}$
as does Maple $[3-2\_t_{1}+\_t_{2},\_t_{1},\_t_{2},-2+3\_t_{1}-2\_t_{2}]$ .
6. The solution set is empty and Maple replies to the linsolve(A,u) command with no returned solutions.
Problem 4

What does the computer give for the solution of the general $2\!\times \!2$  system?

${\begin{array}{*{2}{rc}r}ax&+&cy&=&p\\bx&+&dy&=&q\end{array}}$
${\bigl [}-{\frac {-d\,p+q\,c}{-b\,c+a\,d}},{\frac {-b\,p+a\,q}{-b\,c+a\,d}}{\bigr ]}$