# Examples (generated by math-steps.jar) ## diff `x^2 sin(x)` ``` Step 1: Product rule: (f g)' = f' g + f g', with f = x^2 and g = sin(x) (f*g)' = f'*g + f*g', f = x^2, g = sin(x) - Power rule: d/dx [x^n] = n x^(n-1) d/dx [x^2] = 2x - Standard derivative of sin(x) d/dx [sin(x)] = cos(x) Step 2: Put it together d/dx [x^2*sin(x)] = x^2*cos(x) + 2x*sin(x) Step 3: Answer d/dx [x^2*sin(x)] = x^2*cos(x) + 2x*sin(x) ``` ## diff `(x+1)/(x-1)` ``` Step 1: Rewrite the expression (x + 1)/(x - 1) Step 2: Quotient rule: (u/v)' = (u'v - uv') / v^2, with u = x + 1 and v = x - 1 (u/v)' = (u'v - uv')/v^2, u = x + 1, v = x - 1 - Sum rule: differentiate each term separately d/dx [x + 1] = d/dx [x] + d/dx [1] - Derivative of x d/dx [x] = 1 - Constant rule: the derivative of a constant is 0 d/dx [1] = 0 - Add the results d/dx [x + 1] = 1 - Sum rule: differentiate each term separately d/dx [x - 1] = d/dx [x] + d/dx [-1] - Derivative of x d/dx [x] = 1 - Constant rule: the derivative of a constant is 0 d/dx [-1] = 0 - Add the results d/dx [x - 1] = 1 Step 3: Put it together and simplify d/dx [(x + 1)/(x - 1)] = -2/(x - 1)^2 Step 4: Answer d/dx [(x + 1)/(x - 1)] = -2/(x - 1)^2 ``` ## diff `e^(sin(3x))` ``` Step 1: Chain rule: d/dx [e^u] = e^u * u', where u = sin(3x) d/dx [e^u] = e^u*u', u = sin(3x) - Chain rule: d/dx [sin(u)] = cos(u) * u', where u = 3x d/dx [sin(u)] = cos(u) * u', u = 3x - Constant multiple rule: d/dx [c x] = c d/dx [3x] = 3 - Put it together d/dx [sin(3x)] = 3cos(3x) Step 2: Put it together d/dx [e^(sin(3x))] = 3cos(3x)*e^(sin(3x)) Step 3: Answer d/dx [e^(sin(3x))] = 3cos(3x)*e^(sin(3x)) ``` ## int `x e^x` ``` Step 1: Integration by parts: integral u dv = u v - integral v du (choose u by LIATE: logs, inverse trig, algebraic, trig, exponential) u = x, dv = e^x dx, du = 1 dx, v = e^x Step 2: Now integrate v du integral e^x dx - Standard integral: integral e^u du = e^u Standard integral: integral e^u du = e^u => integral e^x dx = e^x Step 3: So u v - integral v du integral x*e^x dx = x*e^x - e^x Step 4: Answer (add the constant of integration C) integral x*e^x dx = x*e^x - e^x + C Step 5: Check: differentiating the answer gives back the integrand d/dx [x*e^x - e^x] = x*e^x (checked) ``` ## int `2x cos(x^2)` ``` Step 1: Constant multiple rule: take the constant 2 outside the integral integral 2x*cos(x^2) dx = 2 * integral x*cos(x^2) dx - Substitution: let u = x^2 u = x^2, du = 2x dx - The integral becomes integral cos(u)/2 du - Constant multiple rule: take the constant 1/2 outside the integral integral cos(u)/2 du = 1/2 * integral cos(u) du - Standard integral: integral cos(u) du = sin(u) integral cos(u) du = sin(u) - Multiply by the constant integral cos(u)/2 du = sin(u)/2 - Substitute back u = x^2 integral x*cos(x^2) dx = sin(x^2)/2 Step 2: Multiply by the constant integral 2x*cos(x^2) dx = sin(x^2) Step 3: Answer (add the constant of integration C) integral 2x*cos(x^2) dx = sin(x^2) + C Step 4: Check: differentiating the answer gives back the integrand d/dx [sin(x^2)] = 2x*cos(x^2) (checked) ``` ## int `(x+3)/(x^2+3x+2)` ``` Step 1: Rewrite the expression (x + 3)/(x^2 + 3x + 2) Step 2: The integrand is a ratio of polynomials: use partial fractions integral (x + 3)/(x^2 + 3x + 2) dx Step 3: Partial fractions: factor the denominator as (x + 1)(x + 2) and split the fraction (x + 3)/(x^2 + 3x + 2) = 2/(x + 1) - 1/(x + 2) - integral A/(x - r) dx = A ln|x - r| integral 2/(x + 1) dx = 2ln|x + 1| - integral A/(x - r) dx = A ln|x - r| integral -1/(x + 2) dx = -ln|x + 2| Step 4: Combine integral (x + 3)/(x^2 + 3x + 2) dx = 2ln|x + 1| - ln|x + 2| Step 5: Answer (add the constant of integration C) integral (x + 3)/(x^2 + 3x + 2) dx = 2ln|x + 1| - ln|x + 2| + C Step 6: Check: differentiating the answer gives back the integrand d/dx [2ln|x + 1| - ln|x + 2|] = (x + 3)/(x^2 + 3x + 2) (checked) ``` ## int `sin(x)^2` ``` Step 1: Use the identity sin^2(u) = (1 - cos(2u))/2 Use the identity sin^2(u) = (1 - cos(2u))/2 => integral sin(x)^2 dx = integral (1 - cos(2x))/2 dx - Constant multiple rule: take the constant 1/2 outside the integral integral (1 - cos(2x))/2 dx = 1/2 * integral (1 - cos(2x)) dx - Sum rule: integrate each term separately integral (1 - cos(2x)) dx = integral -cos(2x) dx + integral 1 dx - Constant multiple rule: take the constant -1 outside the integral integral -cos(2x) dx = -1 * integral cos(2x) dx - Standard integral: integral cos(u) du = sin(u), with the linear substitution u = 2x (du = 2 dx, so divide by 2) Standard integral: integral cos(u) du = sin(u), u = 2x => integral cos(2x) dx = sin(2x)/2 - Multiply by the constant integral -cos(2x) dx = -sin(2x)/2 - Integral of a constant: integral c dx = c x integral 1 dx = x - Add the results integral (1 - cos(2x)) dx = x - sin(2x)/2 - Multiply by the constant integral (1 - cos(2x))/2 dx = (x - sin(2x)/2)/2 Step 2: So integral sin(x)^2 dx = (x - sin(2x)/2)/2 Step 3: Answer (add the constant of integration C) integral sin(x)^2 dx = x/2 - sin(2x)/4 + C Step 4: Check: differentiating the answer gives back the integrand d/dx [x/2 - sin(2x)/4] = sin(x)^2 (checked) ``` ## defint `sin(x)` from 0 to pi ``` Step 1: Standard integral: integral sin(u) du = -cos(u) Standard integral: integral sin(u) du = -cos(u) => integral sin(x) dx = -cos(x) Step 2: Fundamental theorem of calculus: integral from a to b of f = F(b) - F(a), with F = -cos(x) integral from 0 to pi = [-cos(x)] from 0 to pi Step 3: Evaluate at the limits F(pi) - F(0) = (1) - (-1) = 2 Step 4: Answer integral from 0 to pi of sin(x) dx = 2 Step 5: Check: a numerical integration gives the same value Simpson's rule ~ 2 ```