// Numbas version: finer_feedback_settings {"name": "Linear Algebra 1", "metadata": {"description": "", "licence": "None specified"}, "duration": 0, "percentPass": 0, "showQuestionGroupNames": false, "shuffleQuestionGroups": false, "showstudentname": true, "question_groups": [{"name": "Group", "pickingStrategy": "all-ordered", "pickQuestions": 1, "questionNames": ["", "", "", "", "", ""], "variable_overrides": [[], [], [], [], [], []], "questions": [{"name": "Combine linearly dependent vectors to get zero", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"x": {"templateType": "anything", "group": "Ungrouped variables", "definition": "rowvector(-a+b-c,-b+c,a-c,-a+b)", "description": "", "name": "x"}, "w": {"templateType": "anything", "group": "Ungrouped variables", "definition": "rowvector(-al*a+(del-2*ga)*b-del*c,(del-al)*a-(del-ga)*b+del*c,(-del+2*al)*a+ga*b-del*c,(del-2*al)*a+(del-2*ga)*b)", "description": "", "name": "w"}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-3..3 except 0)", "description": "", "name": "b"}, "c": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-3..3 except 0)", "description": "", "name": "c"}, "z": {"templateType": "anything", "group": "Ungrouped variables", "definition": "rowvector(-b-c,a+c,-a+b-c,a-b)", "description": "", "name": "z"}, "al": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-2,-1,1,2)", "description": "", "name": "al"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..4)", "description": "", "name": "t"}, "c2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(t=2,1/(1-del),if(t=1,-al/(1-del),-(del-al-ga)/(1-del)))", "description": "", "name": "c2"}, "v4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(t=4,w,z)", "description": "", "name": "v4"}, "c1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(t=1,1/(1-del),-al/(1-del))", "description": "", "name": "c1"}, "ga": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-2,-1,1,2)", "description": "", "name": "ga"}, "y": {"templateType": "anything", "group": "Ungrouped variables", "definition": "rowvector(b-c,a-b+c,-a-c,a+b)", "description": "", "name": "y"}, "v1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(t=1,w, x)", "description": "", "name": "v1"}, "c4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(t=4,1/(1-del),-ga/(1-del))", "description": "", "name": "c4"}, "c3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(t=3,1/(1-del),if(t=4,-ga/(1-del),-(del-al-ga)/(1-del)))", "description": "", "name": "c3"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-3..3 except 0)", "description": "", "name": "a"}, "del": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0,-1,-3,-4)", "description": "", "name": "del"}, "v2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(t=1,x,t=2,w,y)", "description": "", "name": "v2"}, "v3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(t=3,w,t=4,z,y)", "description": "", "name": "v3"}}, "ungrouped_variables": ["a", "x", "c", "b", "ga", "al", "y", "v1", "v2", "v3", "v4", "t", "w", "c2", "c3", "del", "c1", "z", "c4"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "c1", "minValue": "c1", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "c2", "minValue": "c2", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "c3", "minValue": "c3", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "c4", "minValue": "c4", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "
Find $a,\\;b,\\;c$ and $d$
\n$a=$ [[0]]
\n$b=$ [[1]]
\n$c=$ [[2]]
\n$d=$ [[3]]
\nInput all values as exact decimals.
", "showCorrectAnswer": true, "marks": 0}], "statement": "You are given the following four vectors in $\\mathbb{R}^4$: \\[\\begin{align} \\textbf{v}_1&=\\var{v1}\\\\ \\textbf{v}_2&=\\var{v2}\\\\ \\textbf{v}_3&=\\var{v3}\\\\ \\textbf{v}_4&=\\var{v4}\\end{align}\\]
\nYou are asked to show that the vectors $\\textbf{v}_1,\\;\\textbf{v}_2,\\;\\textbf{v}_3,\\;\\textbf{v}_4$ are linearly dependent.
\nFind real numbers $a,\\;b,\\;c$ and $d$ such that \\[a\\textbf{v}_1+b\\textbf{v}_2+c\\textbf{v}_3+d\\textbf{v}_4=\\textbf{0},\\;\\;\\; a+b+c+d=1\\]where $\\textbf{0}=\\var{rowvector(0,0,0,0)}$ is the zero vector.
\n", "tags": ["checked2015", "dependent vectors", "linear algebra", "linear combination of vectors", "linear dependence", "linear equations", "linearly dependent vectors", "MAS2223", "solving linear equations", "vectors"], "rulesets": {"std": ["all", "!collectNumbers", "!noleadingminus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "
10/02/2013:
\nFinished first draft. Need to resolve the display of row vectors etc.
\nDisplay of linear equations difficult to format e.g. variables under one another as got to use \\simplify where there are randomised coefficients.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Real numbers $a,\\;b,\\;c$ and $d$ are such that $a+b+c+d=1$ and for the given vectors $\\textbf{v}_1,\\;\\textbf{v}_2,\\;\\textbf{v}_3,\\;\\textbf{v}_4$ $a\\textbf{v}_1+b\\textbf{v}_2+c\\textbf{v}_3+d\\textbf{v}_4=\\textbf{0}$. Find $a,\\;b,\\;c,\\;d$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "On putting $a=1-b-c-d$ we have
\n\\[(1-b-c-d)\\textbf{v}_1+b\\textbf{v}_2+c\\textbf{v}_3+d\\textbf{v}_4=0\\]
\nHence on combining the vectors and equating the four components each to $0$ we have the four equations:
\n\\[\\begin{align} \\simplify[std]{{v1[0][0]} * (1 -b -c -d) + {v2[0][0]} * b + {v3[0][0]} * c + {v4[0][0]} * d }&= 0\\\\ \\simplify[std]{{v1[0][1]} * (1 -b -c -d) + {v2[0][1]} * b + {v3[0][1]} * c + {v4[0][1]} * d }&= 0\\\\ \\simplify[std]{{v1[0][2]} * (1 -b -c -d) + {v2[0][2]} * b + {v3[0][2]} * c + {v4[0][2]} * d }&= 0\\\\ \\simplify[std]{{v1[0][3]} * (1 -b -c -d) + {v2[0][3]} * b + {v3[0][3]} * c + {v4[0][3]} * d }&= 0\\end{align}\\]
\nOn rearranging these equations in the unknowns $b,\\;c,\\;d$ we get:
\n\\[\\begin{align} \\simplify[std]{{v2[0][0] -v1[0][0]} * b + {v3[0][0] -v1[0][0]} * c + {v4[0][0] -v1[0][0]} * d} &= \\var{-v1[0][0]}\\\\ \\simplify[std]{{v2[0][1] -v1[0][1]} * b + {v3[0][1] -v1[0][1]} * c + {v4[0][1] -v1[0][1]} * d }&= \\var{-v1[0][1]}\\\\ \\simplify[std]{{v2[0][2] -v1[0][2]} * b + {v3[0][2] -v1[0][2]} * c + {v4[0][2] -v1[0][2]} * d }&= \\var{-v1[0][2]}\\\\ \\simplify[std]{{v2[0][3] -v1[0][3]} * b + {v3[0][3] -v1[0][3]} * c + {v4[0][3] -v1[0][3]} * d}&= \\var{-v1[0][3]}\\end{align}\\]
\nOn solving these equations we see that although there are more equations than unknowns, the equations are consistent and they have the solution:
\n$b=\\var{c2}$, $c=\\var{c3}$, $d=\\var{c4}$ and hence $a=\\simplify[std]{1- {c2}-{c3}-{c4}= {c1}}$.
"}, {"name": "Ugur's copy of Determine if vectors form a spanning set", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Ugur Efem", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/18261/"}], "tags": ["basis", "checked2015", "euclidean space", "linear algebra", "linear combination", "linear dependence", "linear independence", "linear spaces", "span", "spanning set", "vector spaces"], "metadata": {"description": "Given $5$ vectors in $\\mathbb{R^4}$ determine if a spanning set for $\\mathbb{R^4}$ or not by looking for any simple dependencies between the vectors.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "Consider the following $5$ vectors in $\\mathbb{R^4}$ .
\n\\[\\begin{align} \\textbf{v}_1&=\\var{rowvector(v1)}\\\\ \\textbf{v}_2&=\\var{rowvector(v2)}\\\\ \\textbf{v}_3&=\\var{rowvector(v3)}\\\\ \\textbf{v}_4&=\\var{rowvector(v4)}\\\\ \\textbf{v}_5&=\\var{rowvector(v5)}\\end{align}\\]
\n", "advice": "
1. Not linearly independent as any set of more than $4$ vectors in $\\mathbb{R^4}$ is linearly dependent.
\n2. They are spanning if any vector in $\\mathbb{R^4}$ can be written as a linear combination of these vectors. This means that there must be $4$ linearly independent vectors in the list. If there are not then it is not spanning.
\n3. This set {contains} a linearly independent subset of $4$ vectors as it is {nt} spanning.
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"contains": {"name": "contains", "group": "Ungrouped variables", "definition": "if(mm[0]=1, \"contains\", \"does not contain\")", "description": "", "templateType": "anything", "can_override": false}, "mm": {"name": "mm", "group": "Ungrouped variables", "definition": "switch(u=3 or u=6 or u=7 or u=8 or u=9,[1,0],[0,1])", "description": "", "templateType": "anything", "can_override": false}, "t0": {"name": "t0", "group": "Ungrouped variables", "definition": "if(u<4,2,if(u<7,3,if(u<9,4,5)))", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(-3..3 except 0)", "description": "", "templateType": "anything", "can_override": false}, "f1": {"name": "f1", "group": "Ungrouped variables", "definition": "if(u<9,al,0)", "description": "", "templateType": "anything", "can_override": false}, "z": {"name": "z", "group": "Ungrouped variables", "definition": "[-b-c,a+c,-a+b-c,a-b]", "description": "", "templateType": "anything", "can_override": false}, "q": {"name": "q", "group": "Ungrouped variables", "definition": "list(al*vector(x)+be*vector(y))", "description": "", "templateType": "anything", "can_override": false}, "nt": {"name": "nt", "group": "Ungrouped variables", "definition": "if(mm[0]=1, \" \", \"not\")", "description": "", "templateType": "anything", "can_override": false}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "if(c5+a+b=0, if(c5+1=0,c5+2,c5+1),c5)", "description": "", "templateType": "anything", "can_override": false}, "y": {"name": "y", "group": "Ungrouped variables", "definition": "[b-c,a-b+c,-a-c,a+b]", "description": "", "templateType": "anything", "can_override": false}, "ep": {"name": "ep", "group": "Ungrouped variables", "definition": "if(al=0 and be=0,random(1,-1),if(al=0 and ga=0,random(1,-1), if(be=0 and ga=0,random(1,-1),0)))", "description": "", "templateType": "anything", "can_override": false}, "be": {"name": "be", "group": "Ungrouped variables", "definition": "random(0,1,-1)", "description": "", "templateType": "anything", "can_override": false}, "ga1": {"name": "ga1", "group": "Ungrouped variables", "definition": "if(al1*be1=0,random(1,-1),0)", "description": "", "templateType": "anything", "can_override": false}, "v": {"name": "v", "group": "Ungrouped variables", "definition": "[-b+c,a-c,-a+b,a-b+c] ", "description": "", "templateType": "anything", "can_override": false}, "v2": {"name": "v2", "group": "Ungrouped variables", "definition": "if(u>3,y,p1)", "description": "", "templateType": "anything", "can_override": false}, "x": {"name": "x", "group": "Ungrouped variables", "definition": "[-a+b-c,-b+c,a-c,-a+b]", "description": "", "templateType": "anything", "can_override": false}, "v1": {"name": "v1", "group": "Ungrouped variables", "definition": "x", "description": "", "templateType": "anything", "can_override": false}, "f2": {"name": "f2", "group": "Ungrouped variables", "definition": "if(u<4,0,be)", "description": "", "templateType": "anything", "can_override": false}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random(-3..3 except 0)", "description": "", "templateType": "anything", "can_override": false}, "f3": {"name": "f3", "group": "Ungrouped variables", "definition": "if(u<7,0,ga)", "description": "", "templateType": "anything", "can_override": false}, "es": {"name": "es", "group": "Ungrouped variables", "definition": "if(mm[0]=1,'','s')", "description": "", "templateType": "anything", "can_override": false}, "thismany": {"name": "thismany", "group": "Ungrouped variables", "definition": "if(mm[0]=1,1,2)", "description": "", "templateType": "anything", "can_override": false}, "p2": {"name": "p2", "group": "Ungrouped variables", "definition": "if(u=1 or u=4,list(al1*vector(x)+be1*vector(y)),\n if(u=2 or u=5 or u=7,list(al1*vector(x)+be1*vector(y)+ga1*vector(z)),\n list(al1*vector(x))))", "description": "", "templateType": "anything", "can_override": false}, "c5": {"name": "c5", "group": "Ungrouped variables", "definition": "random(-3..3 except 0)", "description": "", "templateType": "anything", "can_override": false}, "are": {"name": "are", "group": "Ungrouped variables", "definition": "if(mm[0]=1,\"is only\", \"are\")", "description": "", "templateType": "anything", "can_override": false}, "al": {"name": "al", "group": "Ungrouped variables", "definition": "random(1,-1)", "description": "", "templateType": "anything", "can_override": false}, "eg": {"name": "eg", "group": "Ungrouped variables", "definition": "if(mm[0]=1,'','This is one of the relations.')", "description": "", "templateType": "anything", "can_override": false}, "be1": {"name": "be1", "group": "Ungrouped variables", "definition": "random(0,1,-1)", "description": "", "templateType": "anything", "can_override": false}, "v4": {"name": "v4", "group": "Ungrouped variables", "definition": "if(u=7 or u=8,p1,if(u=9,v,if(u=4 or u=1,p2,z)))", "description": "", "templateType": "anything", "can_override": false}, "r": {"name": "r", "group": "Ungrouped variables", "definition": "list(al*vector(x)+be*vector(y)+ga*vector(z))", "description": "", "templateType": "anything", "can_override": false}, "ga": {"name": "ga", "group": "Ungrouped variables", "definition": "if(al*be=0, random(1,-1),0)", "description": "", "templateType": "anything", "can_override": false}, "v5": {"name": "v5", "group": "Ungrouped variables", "definition": "if(u=1 or u=4,z,if(u =2 or u=5 or u=7,p2, if(u=9,p1,v)))", "description": "", "templateType": "anything", "can_override": false}, "f4": {"name": "f4", "group": "Ungrouped variables", "definition": "if(u<9,0,ep)", "description": "", "templateType": "anything", "can_override": false}, "al1": {"name": "al1", "group": "Ungrouped variables", "definition": "random(1,-1)", "description": "", "templateType": "anything", "can_override": false}, "u": {"name": "u", "group": "Ungrouped variables", "definition": "random(1..9 except [7,9])", "description": "", "templateType": "anything", "can_override": false}, "t": {"name": "t", "group": "Ungrouped variables", "definition": "list(ep*vector(v))", "description": "", "templateType": "anything", "can_override": false}, "p1": {"name": "p1", "group": "Ungrouped variables", "definition": "if(u<4,list(al*vector(x)),if(u<7,q,if(u<9,r,t)))", "description": "", "templateType": "anything", "can_override": false}, "another": {"name": "another", "group": "Ungrouped variables", "definition": "if(mm[0]=1, \"Hence this is a spanning set. \", \"There is one other simple relationship - you find this! So this is not a spanning set as it contains less than 4 linearly independent vectors.\")", "description": "", "templateType": "anything", "can_override": false}, "v3": {"name": "v3", "group": "Ungrouped variables", "definition": "if(u>6,z,if(u>3,p1,y))", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["f1", "f2", "f3", "f4", "another", "eg", "al", "ga1", "are", "ga", "ep", "es", "contains", "be1", "nt", "be", "v1", "v2", "v3", "v4", "v5", "b", "c5", "al1", "a", "c", "p1", "thismany", "mm", "t0", "q", "p2", "r", "u", "t", "v", "y", "x", "z"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "1. Is $\\{\\textbf{v}_1,\\;\\textbf{v}_2,\\;\\textbf{v}_3,\\;\\textbf{v}_4,\\;\\textbf{v}_5\\}$ a linearly independent set of vectors? [[0]]
\n\n
2. Do the above vectors form a spanning set of $\\mathbb{R}^4$? [[1]]
\n\n
3. Does the set $\\{\\textbf{v}_1,\\;\\textbf{v}_2,\\;\\textbf{v}_3,\\;\\textbf{v}_4,\\;\\textbf{v}_5\\}$ contain a linearly independent subset which forms a basis of $\\mathbb{R}^4$? [[2]]
", "gaps": [{"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Yes
", "No
"], "matrix": [0, 1], "distractors": ["", ""]}, {"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": true, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Yes
", "No
"], "matrix": "mm"}, {"type": "1_n_2", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Yes
", "No
"], "matrix": "mm"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Characteristic poly, eigenvalues and eigenvectors 3x3, digonailsability (non-randomised)", "extensions": ["linalg2", "linear-algebra"], "custom_part_types": [{"source": {"pk": 2, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/2/edit"}, "name": "List of numbers", "short_name": "list-of-numbers", "description": "The answer is a comma-separated list of numbers.
\nThe list is marked correct if each number occurs the same number of times as in the expected answer, and no extra numbers are present.
\nYou can optionally treat the answer as a set, so the number of occurrences doesn't matter, only whether each number is included or not.
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "join(\n if(settings[\"correctAnswerFractions\"],\n map(let([a,b],rational_approximation(x), string(a/b)),x,settings[\"correctAnswer\"])\n ,\n settings[\"correctAnswer\"]\n ),\n settings[\"separator\"] + \" \"\n)", "hint": {"static": false, "value": "if(settings[\"show_input_hint\"],\n \"Enter a list of numbers separated by{settings['separator']}
.\",\n \"\"\n)"}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "bits:\nlet(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)\n\nexpected_numbers:\nlet(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)\n\nvalid_numbers:\nif(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )\n\nis_sorted:\nassert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )\n\nincluded:\nmap(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentIs every number in the student's list valid?
", "definition": "if(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )"}, {"name": "is_sorted", "description": "Are the student's answers in ascending order?
", "definition": "assert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )"}, {"name": "included", "description": "Is each number in the expected answer present in the student's list the correct number of times?
", "definition": "map(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentTrue if the student's list doesn't contain any numbers that aren't in the expected answer.
", "definition": "if(all(map(x in expected_numbers, x, interpreted_answer)),\n true\n ,\n incorrect(\"Your answer contains \"+extra_numbers[0]+\" but should not.\");\n false\n )"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "if(lower(studentAnswer) in [\"empty\",\"\u2205\"],[],\n map(\n if(settings[\"allowFractions\"],parsenumber_or_fraction(x,notationStyles), parsenumber(x,notationStyles))\n ,x\n ,bits\n )\n)"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=\"\",fail(\"You have not entered an answer\"),false);\napply(valid_numbers);\napply(included);\napply(no_extras);\ncorrectif(all_included and no_extras)"}, {"name": "notationStyles", "description": "", "definition": "[\"en\"]"}, {"name": "isSet", "description": "Should the answer be considered as a set, so the number of times an element occurs doesn't matter?
", "definition": "settings[\"isSet\"]"}, {"name": "extra_numbers", "description": "Numbers included in the student's answer that are not in the expected list.
", "definition": "filter(not (x in expected_numbers),x,interpreted_answer)"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The list of numbers that the student should enter. The order does not matter.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "allowFractions", "label": "Allow the student to enter fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "correctAnswerFractions", "label": "Display the correct answers as fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "isSet", "label": "Is the answer a set?", "help_url": "", "hint": "If ticked, the number of times an element occurs doesn't matter, only whether it's included at all.", "input_type": "checkbox", "default_value": false}, {"name": "show_input_hint", "label": "Show the input hint?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": true}, {"name": "separator", "label": "Separator", "help_url": "", "hint": "The substring that should separate items in the student's list", "input_type": "string", "default_value": ",", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Julia Goedecke", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5121/"}, {"name": "Ugur Efem", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/18261/"}], "tags": ["characteristic polynomial", "eigenvalues", "Eigenvalues", "Eigenvectors", "eigenvectors", "explore mode", "Linear algebra", "Linear Algebra", "linear algebra"], "metadata": {"description": "Example of an explore mode question. Student is given a 3x3 matrix and is asked to find the characteristic polynomial and eigenvalues, and then eigenvectors for each eigenvalue. The part asking for eigenvectors can be repeated as often as the student wants, to be used for different eigenvalues.
\nAssessed: calculating characteristic polynomial and eigenvectors.
\nFeature: any correct eigenvalue will be recognised by the marking algorithm, even multiples of the obvious one(s) (which can be read off from the reduced row echelon form)
\nRandomisation: Not randomised, just using particular matrices. I am still working on how to randomise this for 3x3; a randomised 2x2 version exists. I have several different versions for 3x3 (not all published yet), so I could make a random choice between these in a test.
\nThe implementation uses linear algebra functions such as \"find reduced echelon form\" or \"find kernel of a reduced echelon form\", from the extension \"linalg2\".
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "Find the characteristic polynomial, eigenvalues and eigenvectors (bases for eigenspaces) for the matrix \\(\\var{matrixA}\\). Decide whether the matrix is diagonalisable.
", "advice": "The characteristic polynomial of \\(A\\) is defined as \\(\\chi_A(t)=\\det(tI-A)\\). So in this case you should calculate
\n\\(\\begin{vmatrix} \\simplify{t-{matrixA[0][0]}} & \\var{-matrixA[0][1]} & \\var{-matrixA[0][2]} \\\\ \\var{-matrixA[1][0]} & \\simplify{t-{matrixA[1][1]}} & \\var{-matrixA[1][2]}\\\\ \\var{-matrixA[2][0]} & \\var{-matrixA[2][1]} & \\simplify{t-{matrixA[2][2]}} \\end{vmatrix}=(\\simplify{t-{matrixA[0][0]}})\\begin{vmatrix} \\simplify{t-{matrixA[1][1]}} & \\var{-matrixA[1][2]}\\\\ \\var{-matrixA[2][1]} & \\simplify{t-{matrixA[2][2]}} \\end{vmatrix}=\\simplify[]{(t-{matrixA[0][0]})((t-{matrixA[1][1]})(t-{matrixA[2][2]})-{matrixA[1][2]*matrixA[2][1]})}= \\var{chiA}=\\var{chiAexpanded}\\).
\nHere we first expanded the determinant in the first column, and then we used the formula for the determinant a \\(2\\times 2\\) matrix in the last step: \\( \\begin{vmatrix}a&b\\\\c&d\\end{vmatrix}=ad-bc\\).
\nThe eigenvalues are exactly the roots of the characteristic polynomial. So the eigenvalues of \\(A\\) are \\(\\var{a}\\), \\(\\var{b}\\) and \\(\\var{c}\\).
\nTo calculate the eigenvectors for a given eigenvalues \\(\\lambda\\), we calculate the kernel of \\(A-\\lambda I\\). So, for
\n\\(\\lambda=\\var{a}\\), we calculate the kernel of \\(\\var{matrixA-a*id(n)}\\). The reduced row echelon form is \\(\\var[fractionNumbers]{RREFa}\\). So the eigenvector for \\(\\lambda=\\var{a}\\) is
\n\\(\\var[fractionNumbers]{v1}\\) (or any multiple of this).
\nAnd for \\(\\lambda=\\var{b}\\), the reduced row echelon form of \\(\\var{matrixA-b*id(n)}\\) is \\(\\var[fractionNumbers]{RREFb}\\), and the eigenvector is \\(\\var[fractionNumbers]{v2}\\) (or any multiple).
\nAnd for \\(\\lambda=\\var{c}\\), the reduced row echelon form of \\(\\var{matrixA-c*id(n)}\\) is \\(\\var[fractionNumbers]{RREFc}\\), and the eigenvector is \\(\\var[fractionNumbers]{v3}\\) (or any multiple).
Recall that the algebraic multiplicity of an eigenvalue is it multiplicity as a root of the characteristic polynomial. Then, it is clear that all the eigenvalues of \\(A\\) has albegraic multiplicity \\(1\\).
Also, recall that the geometric multiplicity of an eigenvalue \\(\\lambda\\) is the dimension of the subspace genereted by eigenvectors associated to \\(\\lambda\\). Observe that here every eigenvalue has geometric multiplicty \\(1\\). Therefore, for every eigenvalue, its algebraic and geoemtric multiplicities are eqaul. That implies \\(A\\) is diagonalisable.
", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"matrixA": {"name": "matrixA", "group": "Ungrouped variables", "definition": "matrix([5,1,3],[0,-1,0],[0,1,2])", "description": "", "templateType": "anything", "can_override": false}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "-1", "description": "", "templateType": "anything", "can_override": false}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "2", "description": "", "templateType": "anything", "can_override": false}, "chiA": {"name": "chiA", "group": "Ungrouped variables", "definition": "simplify(expression(\"(t-{a})*(t-{b})*(t-{c})\"),\"all\")", "description": "", "templateType": "anything", "can_override": false}, "v1": {"name": "v1", "group": "Ungrouped variables", "definition": "transpose(matrix(le_kernel(RREFa)))", "description": "", "templateType": "anything", "can_override": false}, "v2": {"name": "v2", "group": "Ungrouped variables", "definition": "transpose(matrix(le_kernel(RREFb)))", "description": "", "templateType": "anything", "can_override": false}, "RREFa": {"name": "RREFa", "group": "Ungrouped variables", "definition": "matrix(le_red_echelon(matrixA-a*id(n)))", "description": "", "templateType": "anything", "can_override": false}, "RREFb": {"name": "RREFb", "group": "Ungrouped variables", "definition": "matrix(le_red_echelon(matrixA-b*id(n)))", "description": "", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "3", "description": "", "templateType": "anything", "can_override": false}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "5", "description": "", "templateType": "anything", "can_override": false}, "RREFc": {"name": "RREFc", "group": "Ungrouped variables", "definition": "matrix(le_red_echelon(matrixA-c*id(n)))", "description": "", "templateType": "anything", "can_override": false}, "v3": {"name": "v3", "group": "Ungrouped variables", "definition": "transpose(matrix(le_kernel(RREFc)))", "description": "", "templateType": "anything", "can_override": false}, "chiAexpanded": {"name": "chiAexpanded", "group": "Ungrouped variables", "definition": "simplify(expression(\"(t-{a})*(t-{b})*(t-{c})\"),[\"all\",\"expandBrackets\"])", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["matrixA", "a", "b", "c", "chiA", "v1", "v2", "v3", "RREFa", "RREFb", "RREFc", "n", "chiAexpanded"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": true, "customName": "Char poly", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [{"label": "evectors", "rawLabel": "", "otherPart": 1, "variableReplacements": [], "availabilityCondition": "", "penalty": "", "penaltyAmount": 0, "showPenaltyHint": true, "lockAfterLeaving": false}], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "characteristic polynomial \\(\\chi_A(t)= \\) [[0]]
\nThe eigenvalues of \\(A\\) are (in any order): [[1]]
\n", "gaps": [{"type": "jme", "useCustomName": true, "customName": "char_A", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": "char_A", "answer": "{chiA}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}, {"type": "list-of-numbers", "useCustomName": true, "customName": "evals", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "included:\nmap(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentand enter the corresponding eigenvector(s).
\nEnter a basis for the relevant eigenspace of \\(A\\), i.e. a linearly independent set of eigenvectors for your chosen eigenvalue, as the columns of a matrix. E.g. if there is only one eigenvector, select \"1 column\" and enter the vector. If there are two, select \"2 columns\" and enter the first vector in the first column and the second vector in the second column, etc. This way you can determine how many eigenvectors there are.
\n[[1]]
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "a", "maxValue": "a", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "matrix", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": false, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "correctAnswer": "v1", "correctAnswerFractions": false, "numRows": 1, "numColumns": 1, "allowResize": true, "tolerance": 0, "markPerCell": false, "allowFractions": true, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0, "prefilledCells": ""}], "sortAnswers": false}, {"type": "1_n_2", "useCustomName": true, "customName": "Diagonalisability", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Is \\(A\\) diagonalisable?
", "minMarks": 0, "maxMarks": 0, "shuffleChoices": false, "displayType": "radiogroup", "displayColumns": 0, "showCellAnswerState": true, "choices": ["Yes", "No"], "matrix": ["1", 0], "distractors": ["", ""]}], "partsMode": "explore", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Ugur's copy of Eigenvalues", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Heather Driscoll", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1703/"}, {"name": "Ugur Efem", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/18261/"}], "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "Find the eigenvalues of matrix $A$:
\\[ A=\\begin{pmatrix} \\var{a11}&\\var{a12}\\\\ \\var{a21}&\\var{a22} \\end{pmatrix}\\]
Please see lecture notes for worked example.
", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "variables": {"lambda1": {"name": "lambda1", "group": "Ungrouped variables", "definition": "random(-5..-1)", "description": "", "templateType": "anything"}, "lambda2": {"name": "lambda2", "group": "Ungrouped variables", "definition": "random(1..5)", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "-lambda1 - lambda2", "description": "", "templateType": "anything"}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "lambda1 * lambda2", "description": "", "templateType": "anything"}, "a11": {"name": "a11", "group": "Ungrouped variables", "definition": "random(1..5)", "description": "", "templateType": "anything"}, "a22": {"name": "a22", "group": "Ungrouped variables", "definition": "-(b+a11)", "description": "", "templateType": "anything"}, "d": {"name": "d", "group": "Ungrouped variables", "definition": "a11*a22 - c", "description": "", "templateType": "anything"}, "a12": {"name": "a12", "group": "Ungrouped variables", "definition": "random(1..5)", "description": "", "templateType": "anything"}, "a21": {"name": "a21", "group": "Ungrouped variables", "definition": "d/a12", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "mod(d,a12)=0", "maxRuns": "100"}, "ungrouped_variables": ["lambda1", "lambda2", "b", "c", "a11", "a22", "d", "a12", "a21"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Find the eigenvalues of $A$.
\nLet $\\lambda_1$ be the least eigenvalue of $A,\\;\\;\\; \\lambda_1=\\;\\;$[[0]]
\nLet $\\lambda_2$ be the greatest eigenvalue of $A,\\;\\; \\lambda_2=\\;\\;$[[1]]
", "gaps": [{"type": "numberentry", "useCustomName": true, "customName": "lambda1", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{lambda1}", "maxValue": "{lambda1}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": true, "customName": "lambda2", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{lambda2}", "maxValue": "{lambda2}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Ugur's copy of Find eigenvalues, characteristic polynomial and a normalised eigenvector of a 3x3 matrix", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Ugur Efem", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/18261/"}], "variable_groups": [], "variables": {"eigen3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-3..3 except[0,eigen1,eigen2])", "description": "", "name": "eigen3"}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-g*a", "description": "", "name": "b"}, "invp": {"templateType": "anything", "group": "Ungrouped variables", "definition": "matrix([0,1,g],[a,0,1],[b,1,0])", "description": "", "name": "invp"}, "det": {"templateType": "anything", "group": "Ungrouped variables", "definition": "eigen1*eigen2*eigen3", "description": "", "name": "det"}, "coefflam": {"templateType": "anything", "group": "Ungrouped variables", "definition": "-(eigen1*eigen2+eigen1*eigen3+eigen2*eigen3)", "description": "", "name": "coefflam"}, "M": {"templateType": "anything", "group": "Ungrouped variables", "definition": "p*D*invp", "description": "", "name": "M"}, "eigen2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-3..3 except [0,eigen1])", "description": "", "name": "eigen2"}, "coefflamsq": {"templateType": "anything", "group": "Ungrouped variables", "definition": "eigen1+eigen2+eigen3", "description": "", "name": "coefflamsq"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-2..2 except 0)", "description": "", "name": "a"}, "g": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-3..3 except 0)", "description": "", "name": "g"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "matrix([-1,g,1],[b,-g*b,1-b],[a,b,-a])", "description": "", "name": "p"}, "eigen1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-3..3 except 0)", "description": "", "name": "eigen1"}, "D": {"templateType": "anything", "group": "Ungrouped variables", "definition": "matrix([eigen1,0,0],[0,eigen2,0],[0,0,eigen3])", "description": "", "name": "D"}}, "ungrouped_variables": ["a", "b", "D", "g", "det", "M", "coefflamsq", "invp", "p", "coefflam", "eigen2", "eigen3", "eigen1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "eigen1", "minValue": "eigen1", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "eigen3", "minValue": "eigen3", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "You are given that $\\var{vector(1,-b,-a)}$ is an eigenvector of $M$.
\nFind the corresponding eigenvalue: [[0]]
\nAlso $\\var{vector(1,1-b,-a)}$ is an eigenvector of $M$.
\nFind the corresponding eigenvalue: [[1]]
\n", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"answer": "-lambda^3+{coefflamsq}*lambda^2+{coefflam}*lambda+{det}", "showCorrectAnswer": true, "vsetrange": [0, 1], "checkingaccuracy": 0.001, "checkvariablenames": false, "expectedvariablenames": [], "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "type": "jme", "answersimplification": "all", "marks": 1, "vsetrangepoints": 5}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "eigen2", "minValue": "eigen2", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"answer": "{-b}", "vsetrange": [0, 1], "checkingaccuracy": 0.001, "checkvariablenames": false, "expectedvariablenames": [], "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "type": "jme", "showCorrectAnswer": true, "marks": 1, "vsetrangepoints": 5}, {"answer": "{b}/{g}", "vsetrange": [0, 1], "checkingaccuracy": 0.001, "showCorrectAnswer": true, "expectedvariablenames": [], "notallowed": {"message": "Enter numbers as fractions or integers and not as decimals.
", "showStrings": false, "partialCredit": 0, "strings": ["."]}, "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "checkvariablenames": false, "type": "jme", "answersimplification": "all,fractionNumbers", "marks": 1, "vsetrangepoints": 5}], "type": "gapfill", "prompt": "Find the characteristic polynomial of $M$ and hence another eigenvalue for $M$.
\nEnter the characteristic polynomial in the form $P_M(\\lambda) = -\\lambda^3+a\\lambda^2+b\\lambda+c$.
\nWrite the letter $\\lambda$ as lambda
.
Characteristic polynomial: $P_M(\\lambda) = \\;$[[0]]
\nHence find another eigenvalue of $M$: [[1]]
\nFind a corresponding eigenvector for this eigenvalue. Scale your vector such that the first component is $1$. You have to find the other two components:
\nEigenvector = $\\Bigg($ $1$[[2]][[3]] $\\Bigg)$
\nInput both components as fractions or integers and not as decimals.
", "showCorrectAnswer": true, "marks": 0}], "statement": "Let $M=\\var{M}$. Answer the following questions.
", "tags": ["characteristic equation", "characteristic polynomial", "checked2015", "determinant", "eigenvalues", "eigenvectors", "linear algebra", "linear equations", "MAS1602", "matrices", "matrix algebra"], "rulesets": {}, "preamble": {"css": ".vector-input {\n display: inline-block;\n vertical-align: middle;\n text-align: center;\n}\n.vector-input .component {\n float: center;\n clear: both;\n display: block !important;\n text-align: center;\n}\n.vector-input .part {\n margin-top: 0;\n margin-bottom: 0;\n}", "js": ""}, "type": "question", "metadata": {"notes": "Created 19/09/2014
", "licence": "Creative Commons Attribution 4.0 International", "description": "Given a 3 x 3 matrix, and two eigenvectors find their corresponding eigenvalues. Also fnd the characteristic polynomial and using this find the third eigenvalue and a normalised eigenvector $(x=1)$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "For the eigenvector $\\var{vector(1,-b,-a)}$ we have:
\n$\\var{M}\\var{vector(1,-b,-a)}=\\var{vector(eigen1,-eigen1*b,-eigen1*a)}=\\var{eigen1}\\var{vector(1,-b,-a)}$.
\nHence the corresponding eigenvalue is $\\var{eigen1}$.
\nSimilarly, for the eigenvector $\\var{vector(1,1-b,-a)}$ we have:
\n$\\var{M}\\var{vector(1,1-b,-a)}=\\var{vector(eigen3,eigen3*(1-b),-eigen3*a)}=\\var{eigen3}\\var{vector(1,1-b,-a)}$.
\nHence the corresponding eigenvalue for this eigenvector is $\\var{eigen3}$.
\nThe characteristic polynomial is given by $P_M(\\lambda)=\\operatorname{det}(M-\\lambda I_3)$. The roots of this are the eigenvalues.
\nWe find that in this case:
\n\\[\\begin{align}\\operatorname{det}(M-\\lambda I_3)&=\\operatorname{det}\\begin{pmatrix}\\var{m[0][0]}-\\lambda &\\var{m[0][1] }&\\var{m[0][2]}\\\\ \\var{m[1][0]}&\\var{m[1][1] }-\\lambda &\\var{m[1][2]}\\\\ \\var{m[2][0]}&\\var{m[2][1] } &\\var{m[2][2]}-\\lambda \\end{pmatrix}\\\\&=\\simplify{-lambda^3+{coefflamsq}*lambda^2+{coefflam}*lambda+{det}}\\end{align}\\]
\nNow we know that $\\simplify{lambda-{eigen1}}$ and $\\simplify{lambda-{eigen3}}$ are both factors of the characteristic polynomial.
\nHence we have:
\n$\\simplify{-lambda^3+{coefflamsq}*lambda^2+{coefflam}*lambda+{det}=-(lambda-{eigen1})(lambda-{eigen3})(lambda-r)}$ for some number $r$.
\nSince the constant term in the characteristic polynomial is the product of the three eigenvalues, $r=\\simplify[!basic]{{det}/({eigen1}*{eigen3})={eigen2}}$ and this is the third eigenvalue.
\nTo find an eigenvector corresponding to this eigenvalue we solve the equation:
\n$\\simplify{M*vector(x,y,z)={M}*vector(x,y,z)={eigen2}*vector(x,y,z)}$
\nThis gives the equations:
\n\\[\\begin{align} \\simplify{{m[0][0]}*x+{m[0][1]}*y+{m[0][2]}*z}&=\\simplify{{eigen2}*x}\\\\ \\simplify{{m[1][0]}*x+{m[1][1]}*y+{m[1][2]}*z}&=\\simplify{{eigen2}*y}\\\\ \\simplify{{m[2][0]}*x+{m[2][1]}*y+{m[2][2]}*z}&=\\simplify{{eigen2}*z}\\end{align}\\]
\nThe question asked you to find an eigenvector with $x=1$ and if we substitute this into the equations we find (only need to use two of the equations) that $y=\\var{-b}$ and $z=\\simplify[all,fractionNumbers]{{b}/{g}}$.
\nHence the eigenvector we want is $\\simplify[all,fractionNumbers]{vector(1,{-b},{b}/{g})}$.
"}, {"name": "Ugur's copy of Find eigenvalues and eigenvectors of matrices, and power of one matrix", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Ugur Efem", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/18261/"}], "variable_groups": [], "variables": {"s1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,-1)", "description": "", "name": "s1"}, "mxb": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(a1,b1)", "description": "", "name": "mxb"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-8..8)", "description": "", "name": "a"}, "x1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "s*(b22-mnB)", "description": "", "name": "x1"}, "a22": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a+b-a11", "description": "", "name": "a22"}, "x2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "s*(b22-mxB)", "description": "", "name": "x2"}, "cn22": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mxB^n*x1-mnB^n*x2", "description": "", "name": "cn22"}, "s2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,-1)", "description": "", "name": "s2"}, "a1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-8..8)", "description": "", "name": "a1"}, "cn11": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mnB^n*x1-mxB^n*x2", "description": "", "name": "cn11"}, "da": {"templateType": "anything", "group": "Ungrouped variables", "definition": "{a11*a22-a12*a21}", "description": "", "name": "da"}, "c2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-8..8)", "description": "", "name": "c2"}, "this": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(mxA<0,mxA+random(1..6),mxA-random(1..6))", "description": "", "name": "this"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(4,5,6)", "description": "", "name": "n"}, "trb": {"templateType": "anything", "group": "Ungrouped variables", "definition": "{b11+b22}", "description": "", "name": "trb"}, "b11": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(test1=a1,that,test1=b1,that,test1)", "description": "", "name": "b11"}, "tra": {"templateType": "anything", "group": "Ungrouped variables", "definition": "{a11+a22}", "description": "", "name": "tra"}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(c1=a,a+random(1..3),c1)", "description": "", "name": "b"}, "cn12": {"templateType": "anything", "group": "Ungrouped variables", "definition": "x1*x2*(mxB^n-mnB^n)", "description": "", "name": "cn12"}, "bn21": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(s*cn21/f)", "description": "", "name": "bn21"}, "bn11": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(s*cn11/f)", "description": "", "name": "bn11"}, "cn21": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mnB^n-mxB^n", "description": "", "name": "cn21"}, "b21": {"templateType": "anything", "group": "Ungrouped variables", "definition": "-s", "description": "", "name": "b21"}, "mxa": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(a,b)", "description": "", "name": "mxa"}, "b22": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a1+b1-b11", "description": "", "name": "b22"}, "f": {"templateType": "anything", "group": "Ungrouped variables", "definition": "abs(x1-x2)", "description": "", "name": "f"}, "that": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(mxB<0,mxB+random(1..6),mxB-random(1..6))", "description": "", "name": "that"}, "b1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(c2=a1,a1+random(1..3),c2)", "description": "", "name": "b1"}, "b12": {"templateType": "anything", "group": "Ungrouped variables", "definition": "s*(a1*b1-b11*a1-b11*b1+b11^2)", "description": "", "name": "b12"}, "mnb": {"templateType": "anything", "group": "Ungrouped variables", "definition": "min(a1,b1)", "description": "", "name": "mnb"}, "test": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-8..8)", "description": "", "name": "test"}, "db": {"templateType": "anything", "group": "Ungrouped variables", "definition": "{b11*b22-b12*b21}", "description": "", "name": "db"}, "c1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-8..8)", "description": "", "name": "c1"}, "bn12": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(s*cn12/f)", "description": "", "name": "bn12"}, "test1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-8..8)", "description": "", "name": "test1"}, "mna": {"templateType": "anything", "group": "Ungrouped variables", "definition": "min(a,b)", "description": "", "name": "mna"}, "s": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1,-1)", "description": "", "name": "s"}, "a12": {"templateType": "anything", "group": "Ungrouped variables", "definition": "s", "description": "", "name": "a12"}, "a11": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(test=a,this,test=b,this,test)", "description": "", "name": "a11"}, "a21": {"templateType": "anything", "group": "Ungrouped variables", "definition": "-s*(a*b-a11*a-a11*b+a11^2)", "description": "", "name": "a21"}, "bn22": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(s*cn22/f)", "description": "", "name": "bn22"}}, "ungrouped_variables": ["test1", "a21", "a22", "bn22", "bn21", "b22", "b21", "b1", "cn11", "mna", "mnb", "cn12", "s2", "s1", "a12", "b12", "b11", "test", "cn21", "cn22", "a11", "that", "db", "bn12", "bn11", "da", "a1", "x2", "c2", "c1", "x1", "mxb", "mxa", "a", "b", "f", "tra", "trb", "n", "this", "s"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{mnA}", "minValue": "{mnA}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{mxA}", "minValue": "{mxA}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "Find the eigenvalues of $A$.
\nLet $a_1$ be the least eigenvalue of $A,\\;\\;\\; a_1=\\;\\;$[[0]]
\nLet $a_2$ be the greatest eigenvalue of $A,\\;\\; a_2=\\;\\;$[[1]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{s*(mnA-a11)}", "minValue": "{s*(mnA-a11)}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{s*(mxA-a11)}", "minValue": "{s*(mxA-a11)}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "Find eigenvectors for $A$.
\nLet $(1,y_1)^T$ be an eigenvector corresponding to $a_1,\\;\\;\\;\\;y_1=\\;\\;$[[0]]
\nLet $(1,y_2)^T$ be an eigenvector corresponding to $a_2,\\;\\;\\;\\;y_2=\\;\\;$[[1]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{mnB}", "minValue": "{mnB}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{mxB}", "minValue": "{mxB}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n \n \nFind the eigenvalues of $B$.
\n \n \n \nLet $b_1$ be the least eigenvalue of $B,\\;\\;\\; b_1=\\;\\;$[[0]]
\n \n \n \nLet $b_2$ be the greatest eigenvalue of $B,\\;\\; b_2=\\;\\;$[[1]]
\n \n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{x1}", "minValue": "{x1}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{x2}", "minValue": "{x2}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "Find eigenvectors for $B$.
\nLet $(x_1,1)^T$ be an eigenvector corresponding to $b_1,\\;\\;\\;\\;x_1=\\;\\;$[[0]]
\nLet $(x_2,1)^T$ be an eigenvector corresponding to $b_2,\\;\\;\\;\\;x_2=\\;\\;$[[1]]
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{bn11}", "minValue": "{bn11}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{bn12}", "minValue": "{bn12}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{bn21}", "minValue": "{bn21}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{bn22}", "minValue": "{bn22}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\nFind $B^{\\var{n}}$ using the last two parts of this question:
\n$B^{\\var{n}} = \\Bigg($ | \n[[0]] | \n[[1]] | \n$\\Bigg)$ | \n
[[2]] | \n[[3]] | \n
Input your answers as integers.
\n ", "showCorrectAnswer": true, "marks": 0}], "statement": "\n \n \nFind the eigenvalues and eigenvectors for the matrices $A$ and $B$ where:
\\[ A=\\begin{pmatrix} \\var{a11}&\\var{a12}\\\\ \\var{a21}&\\var{a22} \\end{pmatrix},\\;\\;\\;\\;\\;\n \n B=\\begin{pmatrix} \\var{b11}&\\var{b12}\\\\ \\var{b21}&\\var{b22} \\end{pmatrix}\n \n \\]
10/07/2012:
\nAdded tags.
\nIn the Advice section it is not explained how to find the trace and the determinant of the matrix - Should this be included?
\nQuestion appears to be working correctly.
\n24/12/2012:
\nChecked calculations, OK. Added tested1 tag.
", "licence": "Creative Commons Attribution 4.0 International", "description": "$A,\\;B$ $2 \\times 2$ matrices. Find eigenvalues and eigenvectors of both. Hence or otherwise, find $B^n$ for largish $n$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "a)
\n\\[A - \\lambda I_2 = \\begin{pmatrix} \\var{a11}-\\lambda & \\var{a12}\\\\ \\var{a21} & \\var{a22}-\\lambda \\end{pmatrix}\\]
Hence the characteristic polynomial $p(\\lambda)$ is: \\[\\begin{eqnarray*} \\mathrm{det}\\left(A-\\lambda I_2 \\right)&=&\\simplify[zeroTerm]{({a11}-lambda)({a22}-lambda)-{a12}*{a21}}\\\\ &=& \\simplify[std]{lambda^2-{trA}*lambda+{dA}}\\\\ &=&\\simplify[std]{(lambda-{a})(lambda-{b})} \\end{eqnarray*} \\]
We see that on solving $p(\\lambda)=0$ we get the eigenvalues:
\\[\\lambda_1=\\var{mnA},\\;\\;\\;\\lambda_2=\\var{mxA}\\]
Note: We could have found the characteristic polynomial by noting that for a 2 × 2 matrix $A$ then the characteristic polynomial is
\\[\\lambda^2-\\mathrm{trace}(A)+\\mathrm{det}(A)\\]
where $\\mathrm{trace}(A) = \\var{trA},\\;\\;\\;\\mathrm{det}(A)=\\var{dA}$
b)
\n1. $\\lambda=\\var{mnA}$
\nWe have the eigenspace is given by all $v=(x,y)^T$ such that $(\\simplify{A-{mnA}}I_2)v=(0,0)^T$ i.e.
\n\\[\\begin{pmatrix} \\var{a11-mnA}&\\var{a12}\\\\ \\var{a21}&\\var{a22-mnA} \\end{pmatrix}\\begin{pmatrix} x \\\\ y \\end{pmatrix} =\\begin{pmatrix} 0 \\\\ 0 \\end{pmatrix}\\]
\nThis gives the two equations:
\n\\[ \\begin{eqnarray*} \\simplify[std]{{a11-mnA}x + {a12}y}&=&0\\\\ \\simplify[std]{{a21}x + {a22-mnA}y}&=&0 \\end{eqnarray*} \\]
There is only one equation here as we see that the equations are the same (one is a multiple of the other).
So putting $x=1$ in the first equation we get $y_1=\\var{-s*(a11-mnA)}$
\nHence the eigenvector we want is \\[\\begin{pmatrix} 1 \\\\ \\var{-s*(a11-mnA)} \\end{pmatrix}\\]
\n2. $\\lambda=\\var{mxA}$
\nIn this case we have the equations:
\n\\[ \\begin{eqnarray*} \\simplify[std]{{a11-mxA}x + {a12}y}&=&0\\\\ \\simplify[std]{{a21}x + {a22-mxA}y}&=&0 \\end{eqnarray*} \\]
\nOnce again there is only one equation, so putting $x=1$ in the first equation we get $y_2=\\var{-s*(a11-mxA)}$
\nHence the eigenvector we want is \\[\\begin{pmatrix} 1 \\\\ \\var{-s*(a11-mxA)} \\end{pmatrix}\\]
\nc)
\nThe characteristic polynomial is given by:
\n\\[p(\\lambda)=\\simplify[std]{lambda^2-{b11+b22}*lambda + {dB}}\\]
\nSolving $p(\\lambda)=0$, we find the eigenvalues for $B$ are:
\\[\\lambda_1=\\var{mnB},\\;\\;\\;\\lambda_2=\\var{mxB}\\]
d)
\n1. $\\lambda=\\var{mnB}$
\nThe equations are:
\\[ \\begin{eqnarray*} \\simplify[std]{{b11-mnB}x + {b12}y}&=&0\\\\ \\simplify[std]{{b21}x + {b22-mnB}y}&=&0 \\end{eqnarray*} \\]
Putting $y=1$ in the second equation we get $x_1=\\var{s*(b22-mnB)}$
\nHence the eigenvector we want is \\[\\begin{pmatrix} \\var{s*(b22-mnB)}\\\\1 \\end{pmatrix}\\]
\n2. $\\lambda=\\var{mxB}$
\nThe equations are:
\\[ \\begin{eqnarray*} \\simplify[std]{{b11-mxB}x + {b12}y}&=&0\\\\ \\simplify[std]{{b21}x + {b22-mxB}y}&=&0 \\end{eqnarray*} \\]
Putting $y=1$ in the second equation we get $x_2=\\var{s*(b22-mxB)}$
Hence the eigenvector we want is \\[\\begin{pmatrix} \\var{s*(b22-mxB)}\\\\1 \\end{pmatrix}\\]
\ne)
\nFor the last part we use the diagonalisation of $B$ given by the last two parts.
\nThus if $x_1,\\;\\;x_2,\\;\\;\\lambda_1,\\;\\;\\lambda_2$ are as above for $B$ then we have $B=PDP^{-1} \\Rightarrow B^{\\var{n}}=PD^{\\var{n}}P^{-1}$ where:
\n\\[\\begin{eqnarray*} P &=& \\begin{pmatrix} x_1 & x_2\\\\1&1 \\end{pmatrix} = \\begin{pmatrix} \\var{s*(b22-mnB)} & \\var{s*(b22-mxB)} \\\\1&1 \\end{pmatrix}\\Rightarrow P^{-1}= \\simplify[std]{1/{x1-x2}}\\begin{pmatrix} 1 & \\var{-s*(b22-mxB)} \\\\-1&\\var{s*(b22-mnB)} \\end{pmatrix}\\\\ \\\\ D&=& \\begin{pmatrix} \\lambda_1 & 0\\\\0&\\lambda_2 \\end{pmatrix} = \\begin{pmatrix} \\var{mnB} & 0\\\\0&\\var{mxB} \\end{pmatrix} \\Rightarrow D^{\\var{n}}=\\begin{pmatrix} \\var{mnB^n} & 0\\\\0&\\var{mxB^n} \\end{pmatrix} \\end{eqnarray*} \\]
\nHence \\[\\begin{eqnarray*}B^{\\var{n}}&=&PD^{\\var{n}}P^{-1}\\\\ \\\\ &=&\\simplify[std]{1/{x1-x2}}\\begin{pmatrix} \\var{s*(b22-mnB)} & \\var{s*(b22-mxB)} \\\\1&1 \\end{pmatrix}\\begin{pmatrix} \\var{mnB^n} & 0\\\\0&\\var{mxB^n} \\end{pmatrix}\\begin{pmatrix} 1 & \\var{-s*(b22-mxB)} \\\\-1&\\var{s*(b22-mnB)} \\end{pmatrix}\\\\ \\\\ &=&\\begin{pmatrix} \\var{bn11} & \\var{bn12}\\\\\\var{bn21}&\\var{bn22} \\end{pmatrix} \\end{eqnarray*} \\]
"}]}], "allowPrinting": true, "navigation": {"allowregen": true, "reverse": true, "browse": true, "allowsteps": true, "showfrontpage": true, "navigatemode": "sequence", "onleave": {"action": "none", "message": ""}, "preventleave": true, "typeendtoleave": false, "startpassword": "", "autoSubmit": true, "allowAttemptDownload": false, "downloadEncryptionKey": "", "showresultspage": "oncompletion"}, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "feedback": {"enterreviewmodeimmediately": true, "showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showpartfeedbackmessageswhen": "always", "showexpectedanswerswhen": "inreview", "showadvicewhen": "inreview", "allowrevealanswer": true, "intro": "", "end_message": "", "results_options": {"printquestions": true, "printadvice": true}, "feedbackmessages": [], "reviewshowexpectedanswer": true, "showanswerstate": true, "reviewshowfeedback": true, "showactualmark": true, "showtotalmark": true, "reviewshowscore": true, "reviewshowadvice": true}, "diagnostic": {"knowledge_graph": {"topics": [], "learning_objectives": []}, "script": "diagnosys", "customScript": ""}, "contributors": [{"name": "Ugur Efem", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/18261/"}], "extensions": ["linalg2", "linear-algebra"], "custom_part_types": [{"source": {"pk": 2, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/2/edit"}, "name": "List of numbers", "short_name": "list-of-numbers", "description": "The answer is a comma-separated list of numbers.
\nThe list is marked correct if each number occurs the same number of times as in the expected answer, and no extra numbers are present.
\nYou can optionally treat the answer as a set, so the number of occurrences doesn't matter, only whether each number is included or not.
", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "join(\n if(settings[\"correctAnswerFractions\"],\n map(let([a,b],rational_approximation(x), string(a/b)),x,settings[\"correctAnswer\"])\n ,\n settings[\"correctAnswer\"]\n ),\n settings[\"separator\"] + \" \"\n)", "hint": {"static": false, "value": "if(settings[\"show_input_hint\"],\n \"Enter a list of numbers separated by{settings['separator']}
.\",\n \"\"\n)"}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "bits:\nlet(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)\n\nexpected_numbers:\nlet(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)\n\nvalid_numbers:\nif(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )\n\nis_sorted:\nassert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )\n\nincluded:\nmap(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentIs every number in the student's list valid?
", "definition": "if(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )"}, {"name": "is_sorted", "description": "Are the student's answers in ascending order?
", "definition": "assert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )"}, {"name": "included", "description": "Is each number in the expected answer present in the student's list the correct number of times?
", "definition": "map(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentTrue if the student's list doesn't contain any numbers that aren't in the expected answer.
", "definition": "if(all(map(x in expected_numbers, x, interpreted_answer)),\n true\n ,\n incorrect(\"Your answer contains \"+extra_numbers[0]+\" but should not.\");\n false\n )"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "if(lower(studentAnswer) in [\"empty\",\"\u2205\"],[],\n map(\n if(settings[\"allowFractions\"],parsenumber_or_fraction(x,notationStyles), parsenumber(x,notationStyles))\n ,x\n ,bits\n )\n)"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=\"\",fail(\"You have not entered an answer\"),false);\napply(valid_numbers);\napply(included);\napply(no_extras);\ncorrectif(all_included and no_extras)"}, {"name": "notationStyles", "description": "", "definition": "[\"en\"]"}, {"name": "isSet", "description": "Should the answer be considered as a set, so the number of times an element occurs doesn't matter?
", "definition": "settings[\"isSet\"]"}, {"name": "extra_numbers", "description": "Numbers included in the student's answer that are not in the expected list.
", "definition": "filter(not (x in expected_numbers),x,interpreted_answer)"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The list of numbers that the student should enter. The order does not matter.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "allowFractions", "label": "Allow the student to enter fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "correctAnswerFractions", "label": "Display the correct answers as fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "isSet", "label": "Is the answer a set?", "help_url": "", "hint": "If ticked, the number of times an element occurs doesn't matter, only whether it's included at all.", "input_type": "checkbox", "default_value": false}, {"name": "show_input_hint", "label": "Show the input hint?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": true}, {"name": "separator", "label": "Separator", "help_url": "", "hint": "The substring that should separate items in the student's list", "input_type": "string", "default_value": ",", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": []}