// Numbas version: exam_results_page_options {"name": "Integration: By Parts 6", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Integration: By Parts 6", "tags": [], "metadata": {"description": "
Calculating the integral of a function of the form $e^{ax} \\cos(x)$ using integration by parts.
", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "Calculate the integral \\[ \\simplify{int(e^({a}x) cos(x),x)}\\]
", "advice": "If we have a function of $x$ which is the product of two functions of $x$, to integrate such a function it is often necessary to use Integration by Parts. The formula for Integration by Parts is:
\n\\[ \\int u(x) \\frac{dv}{dx} dx = u(x)v(x) - \\int v(x) \\frac{du}{dx} dx.\\]
\nUsing this method can be broken down into steps:
\nFor the integral
\n\\[ \\simplify{int(e^({a}x)cos(x),x)},\\]
\nwe must first identify $u(x)$ and $\\tfrac{dv}{dx}$. In this case, let \\[ u(x)=\\simplify{e^({a}x)},\\quad \\frac{dv}{dx}= \\simplify{cos(x)}. \\]
\nNext, we need to calculate $\\tfrac{du}{dx}$ and $v(x)$:
\n\\[ \\begin{split} u(x) = \\simplify{e^({a}x)} \\quad &\\implies \\frac{du}{dx} = \\simplify{{a}e^({a}x)}; \\\\ \\frac{dv}{dx} = \\cos(x) &\\implies v(x) = \\sin(x). \\end{split} \\]
\nPlugging these 4 terms into the integration by parts formula:
\n\\[ \\begin{split} \\simplify{int(e^({a}x)cos(x),x)} &\\,= \\simplify{e^({a}x)sin(x) - int({a}e^({a}x)sin(x),x)}, \\\\ &\\,= \\simplify{e^({a}x)sin(x)-{a}int(e^({a}x)sin(x),x)}.\\end{split} \\]
\nSince the integral on the right-hand side is still the product of two functions of $x$, we need to use integration by parts again.
\nSo, for
\n\\[ \\simplify{int(e^({a}x)sin(x),x)}, \\]
\nLet $u=\\simplify{e^({a}x)}$ and $\\tfrac{dv}{dx} = \\sin(x)$. Therefore, $\\tfrac{du}{dx}=\\simplify{{a}e^({a}x)}$ and $v(x)=\\simplify{-cos(x)}$.
\nHence,
\n\\[ \\begin{split} \\simplify{int(e^({a}x)sin(x),x)} &\\,= \\simplify{-e^({a}x)cos(x)- int(-{a}e^({a}x)cos(x),x)} \\\\ \\\\ &\\,= \\simplify[!noLeadingMinus]{-e^({a}x)cos(x)+{a} int(e^({a}x)cos(x),x)}. \\end{split}\\]
\nPlugging this back into the original calculation:
\n\\[ \\begin{split} \\simplify{int(e^({a}x)cos(x),x)} &\\,= \\simplify{e^({a}x)sin(x)-{a}int(e^({a}x)sin(x),x)},\\\\ \\\\&\\,=\\simplify[!noLeadingMinus]{e^({a}x)sin(x)-{a}[-e^({a}x)cos(x)+{a} int(e^({a}x)cos(x),x)]}, \\\\&\\,=\\simplify[!noLeadingMinus]{e^({a}x)sin(x)+{a}e^({a}x)cos(x)-{a^2} int(e^({a}x)cos(x),x)}. \\end{split} \\]
\nAt this point it seems like we may have made a mistake since we still have an interal on the right-hand side made up of two functions of $x$. However, this is a multiple of the initial integral.
\nSo, rather than trying to do integration by parts again (which won't work!), we can combine the two integral terms together on the left-hand side:
\n\\[ \\begin{split} \\simplify{int(e^({a}x)cos(x),x)} &\\,= \\simplify[!noLeadingMinus]{e^({a}x)sin(x)+{a}e^({a}x)cos(x)-{a^2} int(e^({a}x)cos(x),x)}, \\\\ \\simplify{{1+a^2}int(e^({a}x)cos(x),x)} &\\,= \\simplify{e^({a}x)sin(x)+{a}e^({a}x)cos(x)} .\\end{split} \\]
\nTherefore,
\n\\[ \\begin{split} \\simplify{int(e^({a}x)cos(x),x)} &\\,= \\simplify{1/{1+a^2}(e^({a}x)sin(x)+{a}e^({a}x)cos(x))}+c, \\\\ &\\,= \\simplify{1/{1+a^2}e^({a}x)(sin(x)+{a}cos(x))}+c. \\end{split} \\]
\n", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"a": {"name": "a", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a"], "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": "[[0]]
", "gaps": [{"type": "jme", "useCustomName": true, "customName": "Gap 0", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "1/{1+a^2}e^({a}x)(sin(x)+{a}cos(x))+c", "answerSimplification": "fractionNumbers, basic", "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": [{"name": "c", "value": ""}, {"name": "x", "value": ""}]}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}]}]}], "contributors": [{"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}]}