## DESCRIPTION
## Systems of Linear Equations
## ENDDESCRIPTION

## Tagged by tda2d

## DBsubject(Linear algebra)
## DBchapter(Systems of linear equations)
## DBsection(Systems with 2 variables)
## Institution(ASU)
## MLT(uniquesoljj)
## Level(2)
## KEYWORDS('Algebra' 'Linear Equations')

DOCUMENT();        # This should be the first executable line in the problem.

loadMacros(
  "PGstandard.pl",
  "PGasu.pl",
  "PGchoicemacros.pl",
  "extraAnswerEvaluators.pl",
  "PGcourse.pl"
);

TEXT(beginproblem());
$showPartialCorrectAnswers = 1;
install_problem_grader(~~&std_problem_grader);

$x=random(-3,3,1);
$y=random(-3,3,1);
$b1 = 2*$x - 6*$y ;
$b2 = -3*$x + 9*$y;

$mc = new_multiple_choice();
$mc->qa("How many solutions are there to this system?",
"Infinitely many");
$mc->makeLast("None",
"Exactly 1",
"Exactly 2",
"Exactly 3",
"Infinitely many",
"None of the above");

BEGIN_TEXT
Solve the system using the substitution or elimination method
\[ \left\{ "\{"; \}
\begin{array}{l}
        2x-6y = $b1, \\
        -3x+9y = $b2. \\
\end{array}\right.
\]

\{ $mc->print_q() \}
        $PAR
\{ $mc->print_a() \}
$BR
END_TEXT

ANS(radio_cmp($mc->correct_ans));

$ans1 = $inputs_ref->{AnSwEr0001};
if(defined($ans1)) {
  if($ans1 eq "C") {
TEXT("${BBOLD}Hint:$EBOLD 
each solution to this system is an ordered pair with two coordinates.  Together,
the two coordinates make one solution.  Having exactly two solutions is
not possible.");
 } elsif($ans1 eq "D") {
TEXT("${BBOLD}Hint:$EBOLD 
it is not possible for a linear system of equations to ever have exactly 3 solutions.");
 }}


BEGIN_TEXT

$HR

$BR
If there is one solution, give its coordinates in the answer spaces below.  
$PAR
If there
are infinitely many solutions, enter ${BITALIC}x$EITALIC in the answer blank for \(x\)
and enter a formula for \(y\) in terms of \(x\) in the answer blank for \(y\).  
$PAR
If there are no solutions, leave the answer blanks for \(x\) and \(y\) empty.
$BR$BR
\(x = \) \{ans_rule(40) \}
$BR$BR
\(y = \) \{ans_rule(40) \}
END_TEXT

# we use fun_cmp so it doesn't give a syntax error if they try functions
# it still works since we are comparing to a "constant" function, which
# is the same as comparing to a number

$ans1 = "x";
$ans2 = "(2*x-$b1)/6";


ANS(fun_cmp("$ans1",vars=>["x"]));
ANS(fun_cmp("$ans2",vars=>["x"]));

# If there were no solutions, we would use
# ANS(auto_right("this answer can be left blank")); 
# ANS(auto_right("this answer can be left blank"));

ENDDOCUMENT();        # This should be the last executable line in the problem.


#$ans1 = "x";
#$ans2 = "(2*x-$b1)/6";

#ANS(fun_cmp($ans1));
#ANS(fun_cmp($ans2));

COMMENT('This problem has infinitely many solutions.');
#ENDDOCUMENT();        # This should be the last executable line in the problem.
