// 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.\\]

\n

Using this method can be broken down into steps:

\n
    \n
  1. Identify $u(x)$ and $\\tfrac{dv}{dx}$ (The function you pick for each is important, in general you want $u(x)$ to become simpler when differentiating it, and you must be able to integrate $\\tfrac{dv}{dx}$ to find $v(x)$);
  2. \n
  3. Calculate $\\tfrac{du}{dx}$ and $v(x)$;
  4. \n
  5. Put the functions $u(x)$, $v(x)$, and their derivatives into the Integration by Parts formula;
  6. \n
  7. Calculate the integral $\\int v(x) \\tfrac{du}{dx} dx$ (This may require you to use Integration by Parts again, this is OK!);
  8. \n
  9. Simplify your answer where possible and don't forget to add the constant of integration.
  10. \n
\n

\n

For the integral

\n

\\[ \\simplify{int(e^({a}x)cos(x),x)},\\]

\n

we 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)}. \\]

\n

Next, 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} \\]

\n

Plugging 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} \\]

\n

Since the integral on the right-hand side is still the product of two functions of $x$, we need to use integration by parts again. 

\n

So, for 

\n

\\[ \\simplify{int(e^({a}x)sin(x),x)}, \\]

\n

 Let $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)}$.

\n

Hence,

\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}\\]

\n

Plugging 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} \\]

\n

At 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. 

\n

So, 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} \\]

\n

Therefore,

\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/"}]}