// Numbas version: finer_feedback_settings {"name": "Find greatest common divisor of two polynomials over the rationals", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "variables": {"r1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1", "description": "", "name": "r1"}, "d0": {"templateType": "anything", "group": "Ungrouped variables", "definition": "r2*a2*a3+n2", "description": "", "name": "d0"}, "n1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "n*r1", "description": "", "name": "n1"}, "a1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..3)", "description": "", "name": "a1"}, "d1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a2*r2+a3*r2+a2*a3+n1", "description": "", "name": "d1"}, "n2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "n*r2", "description": "", "name": "n2"}, "d2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "r2+a2+a3", "description": "", "name": "d2"}, "c1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a1*(r2*(a2+a3)+a2*a3+n1)+n2+a3+r2*a2*a3+r2", "description": "", "name": "c1"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "5", "description": "", "name": "n"}, "a3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..4)", "description": "", "name": "a3"}, "r2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-3,-2,-1,1,2,3)", "description": "", "name": "r2"}, "c3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "r2+a1+a2+a3", "description": "", "name": "c3"}, "c2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1+a1*(r2+a2+a3)+n1+r2*(a2+a3)+a2*a3", "description": "", "name": "c2"}, "a2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..3)", "description": "", "name": "a2"}, "c0": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a1*r2*a2*a3+a1*n2+r2*a3", "description": "", "name": "c0"}}, "ungrouped_variables": ["r1", "r2", "n", "a1", "a3", "a2", "n1", "c3", "c2", "n2", "c0", "d2", "c1", "d0", "d1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "name": "Find greatest common divisor of two polynomials over the rationals", "functions": {}, "showQuestionGroupNames": false, "parts": [{"stepsPenalty": 0, "scripts": {}, "gaps": [{"answer": "X+{r2}", "showCorrectAnswer": true, "vsetrange": [0, 1], "checkingaccuracy": 0.001, "checkvariablenames": false, "expectedvariablenames": [], "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "type": "jme", "answersimplification": "all", "marks": 1, "vsetrangepoints": 5}], "type": "gapfill", "prompt": "
Consider $f(X)$ and $g(X)$ as polynomials over the rational numbers $\\mathbb{Q}$.
\nFind their greatest common divisor (GCD).
\nGCD=[[0]].
\nYou must input your answer as a monic polynomial over $\\mathbb{Q}$ .
\n\n\n\nClick on Steps to obtain information on monic polynomials.
", "steps": [{"type": "information", "prompt": "Normalized Polynomials.
\n\nA monic polynomial over $\\mathbb{Q}$ has the coefficient of the greatest power equalling 1.
\nIf a polynomial over $\\mathbb{Q}$ has the coefficient of the greatest power $a \\neq 1$, then you multiply the polynomial by $\\frac{1}{a}$.
\n", "showCorrectAnswer": true, "scripts": {}, "marks": 0}], "showCorrectAnswer": true, "marks": 0}], "statement": "Let \\[\\begin{align}\\\\
f(X)&=\\simplify{ X ^ 4 + {c3} * X ^ 3 + {c2} * X ^ 2 + {c1} * X + {c0}}\\\\\\\\
g(X)&=\\simplify{X ^ 3 + {d2} * X ^ 2 + {d1} * X + {d0}}\\end{align}\\]
$f(X)$ and $g(X)$ as polynomials over the rational numbers $\\mathbb{Q}$.
\nFind their greatest common divisor (GCD) and enter as a normalized polynomial.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "First we divide $f(X)$ by $g(X)$ to get the remainder $r_1(X) =\\simplify{ X ^ 2 + {r2 + a3} * X + {r2 * a3}}$ :
\n\\[f(X) = \\simplify{X ^ 4 + {c3} * X ^ 3 + {c2} * X ^ 2 + {c1} * X + {c0} = (X + {a1}) * (X ^ 3 + {d2} * X ^ 2 + {d1} * X + {d0}) + X ^ 2 + {r2 + a3} * X + {r2 * a3}}\\]
\nNext we divide $g(X)$ by $r_1(X)$ to get the remainder $ r_2(X) =\\simplify{ {n1} * X + {n2}}$ :
\n\\[g(X) = \\simplify{X ^ 3 + {d2} * X ^ 2 + {d1} * X + {d0} = (X + {a2}) * (X ^ 2 + {r2 + a3} * X + {r2 * a3}) + {n1} * X + {n2}}\\]
\nNow divide $r_1(X)$ by $r_2(X)$ to obtain:
\n\\[r _1(X) =\\simplify{ X ^ 2 + {r2 + a3} * X + {r2 * a3} = (1 / {n}) * (X + {a3}) * ({n1} * X + {n2})}\\]
\nAs we have zero remainder, the last non-zero remainder is the GCD and this is $\\simplify{{n1} * X + {n2}}$.
\nBut we have to make this into a monic polynomial and the required monic GCD $\\simplify{X+{r2}}$ is given by multiplying by $\\frac{1}{\\var{n1}}$ so that the coefficient of the highest degree term is 1.
", "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}