## WeBWorK Problems

### product of elementary matrices

by Nandor Sieben -
Number of replies: 3
Is there a pg file out there that asks for writing an invertible matrix as a product of elementary matrices? I can't find any in the OPL.

### Re: product of elementary matrices

by Nandor Sieben -
I assume this can be done with MultiAnswer in parserMultiAnswer.pl and Matrix math objects. I tried to find some similar examples in the OPL. I loooked at the diagonalization problems because that problem is somewhat similar but unfortunately I couldn't find one that uses Matrix math objects.

Are matrix math objects used at all in the OPL? Could someone recommend me a good example.

An ideal simple example would be a math object version of a problem that generates a random matrix A and asks for (using MultiAnswer) two non-identity matrices B and C satisfying A=BC.

### Re: product of elementary matrices

by Paul Pearson -
Hi Nandor,

I do not have time right now to modify the example below to suit your needs, but you should be able to make the modifications yourself without too much effort. I have been working on updating the OPL linear algebra questions to use MathObjects, but things are still in development and beta testing.

(Nota: it may be possible to replace $multians->ans_array(2,2,5) with$multians->ans_array(5).)

Best regards,

Paul Pearson

## DESCRIPTION
## Linear Algebra
## ENDDESCRIPTION

## KEYWORDS('linear algebra','matrix','multiplication')
## Tagged by cmd6a 5/3/06

## DBsubject(Linear algebra)
## DBchapter('Matrices')
## DBsection(Matrix algebra)
## Date('July 2013')
## Author('Paul Pearson')
## Institution('Hope College')
## TitleText1('Linear Algebra with Applications')
## AuthorText1('Jeffrey Holt')
## EditionText1('1')
## Section1('3.2')
## Problem1('')

DOCUMENT();
"PGstandard.pl",
"MathObjects.pl",
"PGcourse.pl",
);
$showPartialCorrectAnswers = 0; TEXT(beginproblem()); Context('Matrix');$A = Matrix([[0,1],[0,0]]);
$B = Matrix([[0,1],[0,0]]);$Z = Matrix([[0,0],[0,0]]);

$multians = MultiAnswer($A, $B)->with( singleResult => 1, checker => sub { my ($correct, $student,$self ) = @_;
my @s = @{$student}; my @c = @{$correct};
$s0 = Matrix($s[0]); $s1 = Matrix($s[1]);
return 0 if $s0 ==$Z or $s1 ==$Z;
return $s0 *$s1 == $Z; } ); Context()->texStrings; BEGIN_TEXT Give an example of two $$2 \times 2$$ matrices $$A$$ and $$B$$, neither of which is the zero matrix $$\mathbf{0}$$, such that $$AB = \mathbf{0}$$.$BR
$BR $$A =$$ \{$multians->ans_array(2,2,5) \}
$BR$BR
$$B =$$
\{ $multians->ans_array(2,2,5) \} END_TEXT Context()->normalStrings; install_problem_grader(~~&std_problem_grader); ANS($multians->cmp() );

COMMENT('MathObject version.');

ENDDOCUMENT();