I managed to use the unorderedAnswer with success for a few problems until I encountered this problem.

The error I am getting is:

What would cause such a glitch?

The only difference from previous problems is that there are three answer blocks rather than two.

Any help is most appreciated!

Tim

# DESCRIPTION Problem 4

# Algebra_Review

# WeBWorK problem written by TimPayer <tsp1@humboldt.edu>

# ENDDESCRIPTION

## DBsubject(Algebra)

## DBchapter(Factoring)

## DBsection(Factoring Difference of Squares)

## Institution(Humboldt State University)

## Author(Tim Payer)

## KEYWORDS(reduce, difference of squares)

DOCUMENT();

loadMacros(

"PGstandard.pl",

"MathObjects.pl",

"PGML.pl",

"unorderedAnswer.pl",

"PGcourse.pl"

);

Context("Numeric");

$a = (list_random(2,3,4,5));

do {$b = Real(random(2,11,1));} until (gcd($a,$b) == 1);

do {$c = Real(random(2,11,1));} until (gcd($a,$c) == 1) and (gcd($b,$c) == 1);

$A = Compute("$a*$b*$b");

$B = Compute("$a*$c*$c");

$bb = Compute("$b*$b");

$cc = Compute("$c*$c");

Context()->variables->add(y=>"Real");

$ans1 =$a;

$ans2 =Formula("$b*x+$c*y");

$ans3 =Formula("$b*x-$c*y");

BEGIN_PGML

>> Factor the expression of [``[$A] x^2 -[$B] y^2``] completely.<<

>> Given that the factored form can be expressed as<<

>> A(Bx + C)(Bx - C), <<

>>Find the given factors: <<

>> A = [__________] <<

>> (Bx + Cy) = [__________] <<

>> (Bx - Cy) = [__________] <<

END_PGML

$showPartialCorrectAnswers = 0;

install_problem_grader(~~&std_problem_grader);

UNORDERED_ANS(

$ans1->cmp(),

$ans2->cmp(),

$ans3->cmp(),

);

BEGIN_PGML_SOLUTION

*SOLUTION*

A preliminary check for all factoring problems is to be sure that all common factors have been pulled. Here there are common factors to pull:

[``[$A] x^2 -[$B] y^2 =[$a]\cdot[$bb] x^2-[$a]\cdot[$cc] y^2=[$a]\left([$bb] x^2-[$cc] y^2\right)``]

Next, given the difference of two terms, [``[$a]\left([$bb] x^2-[$cc] y^2\right)``], consider whether the two terms are a difference of squares in the form of [`A^2-B^2`] ? If so this can be reduced using the conjugate pairs of the square roots of each term. Specifically [`A^2-B^2 = (A + B)(A - B)`]

Then we should "see" that [``[$bb] x^2 = \left([$b] x\right)^2``], then [`[$b] x = A`].

Additionally we can see that [``[$cc] = \left([$c] y\right)^2``], then [`[$c] y = B`].

It follows that since [`A^2-B^2 = (A + B)(A - B)`], then so will:

[``[$A] x^2 -[$B] y^2=[$a]([$b] x +[$c] y)([$b] x -[$c] y)``].

END_PGML_SOLUTION

ENDDOCUMENT();