## WeBWorK Problems

### How to Check for one of Two Possible Correct Answers

by Paul Seeburger -
Number of replies: 3
This is probably on the forum already, but a search for "two correct answers" did not bring it up.

I need to allow two options for the correct answer for an answer blank, and it's not just an unordered list (I learned how to deal with this the other day).

In fact, my example is in the middle of an unordered list though.

I am asking a question in the middle of solving an equation by factoring.

For example, if 2x(x-5)(x+3) = 0, I want students to complete the following:

Either ___________ = 0   or   ___________ = 0  or ___________ = 0.

The two binomial factors are no problem.  It's the first factor that could be entered either 2x or x correctly.  I hoped to use an unordered list but then realized this first factor's two possible forms.

Any ideas how to address this?

Thanks!

Paul

### Re: How to Check for one of Two Possible Correct Answers

by Alex Jordan -
If you are concerned about "x" versus "2x", have you considered "2(x-5)" as well? Or "2x-10"? In similar problems, I have seen a student factor a polynomial like this as x(2x-10)(x+3) or -2x(5-x)(x+3).

One idea is to write a custom answer checker using multians. First check that the product of the student's three answers equals the whole polynomial. Then use Adaptive Parameters to check that each piece the student has entered is a scalar multiple of the "fundamental" factors.

### Re: How to Check for one of Two Possible Correct Answers

by Paul Pearson -
Hi Paul,

Like Alex, I would use a multians answer checker to verify that the product of the student's three answers equals the whole polynomial.  Rather than using adaptive parameters, though, I would limit student answers to degree 1 via contextLimitedPowers.pl (which is not a good context for super heroes to use).

minPower => 0, maxPower => 1,
Limited powers are used in this example

http://webwork.maa.org/wiki/FactoredPolynomial1

Best regards,

Paul Pearson

### Re: How to Check for one of Two Possible Correct Answers

by Paul Seeburger -
Thanks, Alex and Paul!

I looked over the Adaptive Parameters and also the LimitedPowers that Paul suggested, but neither looked appropriate for this case to me.  The LimitedPowers seems redundant to the "contextLimitedFactor.pl" that I already use, and it would make impossible some of the more interesting problems (with higher powers) that I think are most helpful.  I just successfully adapted (using bizarroArithmetic.pl) several perfect square trinomial factoring problems to require the factored form to be written as (x + 5)^2, for example, rather than (x+5)(x+5), which I would not consider in simplest form.  I want my online problems to really get students' attention and help them to write the answers (and work when possible) in the best possible ways.

Back to this problem, if the equation factors to 2x(x-5)(x+3) = 0, I really only want to accept "x" or "2x" for the first factor.  I really don't want to see them enter "5x" and get credit, for example, so the Adaptive Parameters seems out of place for this problem, although I will keep it in mind for my Differential Equations problems next semester!

I'd also like to see the students actually factoring the polynomial given to them in the correct form in the first place.  That would eliminate things like (2x-10) for sure, because it is not fully factored.  The contextLimitedFactor does not allow it to be left this way, thankfully.  Unfortunately it does indeed allow -2x(5 - x).  I think it is not in the best form since it contradicts the rule to not have a leading negative on a polynomial when factoring.  Perhaps I am more restrictive than some, but our textbook does teach this rule.  We talk about always writing our polynomial factors in descending order too, which helps achieve this goal.

But I am leaning toward needing to consider this option since it is marked as correct in factored form, but this seems to complicate the problem more than I would like.  Ideally this would mean knowing what all three answers are and making sure they match the factored form above somehow.  Perhaps I will just allow "-2x" and "5 - x" as correct, regardless of what else was entered.  The negative 1 could be divided out of the equation anyway, so it would be justifiable to allow 5 - x as a factor.  I don't think I would want to accept -x - 3 though, so I won't worry about that one.  =)

I will see how the students handle it, I guess, and continue to explore the options.

I got the problem to work allowing me to check for one of two possible correct answers with the following code:

BEGIN_PGML

Now use the *Zero-Product Property* to complete the following three equations, which each give us a solution to the equation.

[________] [= 0],  or   [________] [= 0],  or   [________] [= 0]

END_PGML
$ans1 = Formula("x");$ans2 = Formula("x + $c");$ans3 = Formula("x - $b");$c2 = Formula("$a x"); UNORDERED_ANS($ans1->cmp( checker => sub {
my ( $correct,$student, $self ) = @_; return ($correct == $student ||$c2 == $student); }),$ans2->cmp(),
\$ans3->cmp()
);

Thanks to you both!

Paul