integral from-pi to pi of x*sin(n*x)

The expression x·sin(nx) contains several variables: the variable x is chosen for integration
The parameter n is real and constant during integration. First consider the case n ≠ 0
1) Let's compute the integral: ∫-ππx·sin(nx)dx
For x·sin(nx), apply integration by parts: ∫u1·v2'dx = u1·v2 -∫u1'·v2dx with u1 = x and v2' = sin(nx)
So u1' is equal to 1
⇥1.1) Let's compute the integral v2': ∫sin(nx)dx
⇥For the math expression: sin(nx), since (cos(a))' = -a'·sin(a), we try differentiating cos(nx)
⇥1.2) Let's differentiate: ddx(cos(nx))
⇥Apply the differentiation rule: ddx(cos(f)) = -ddx(f)·sin(f) with f = nx
⇥ⓘ The derivative of cos(x) is -sin(x): ddx(cos(nx)) = -ddx(nx)·sin(nx)
⇥ -ddx(nx)·sin(nx)
⇥ⓘ For differentiation with respect to x, n is treated as constant. The derivative of a constant multiple keeps that factor: that of ku is k·u': ddx(nx) = n·ddx(x) = n·1 = n
⇥ -n·sin(nx)
⇥The computed derivative matches the original math expression up to a constant factor. Therefore, the integral is:
⇥ⓘ Differentiating 1-n·cos(nx) gives sin(nx), so 1-n·cos(nx) is an antiderivative of sin(nx): ∫sin(nx)dx = 1-n·cos(nx)
⇥ 1-n·cos(nx)
⇥ⓘ The sign of a fraction goes in front of the bar, whether it comes from the numerator or the denominator: 1-n = -1n
⇥ -1n·cos(nx)
⇥ⓘ Multiplying a fraction by a term multiplies its numerator: -1n·cos(nx) = -1·cos(nx)n = -cos(nx)n
⇥ -cos(nx)n
⇥So v2 is equal to -cos(nx)n
⇥1.3) Let's evaluate u1·v2 -∫u1'·v2dx: x·(-cos(nx)n) -∫(-cos(nx)n)dx
⇥For the math expression: cos(nx)n, since (sin(a))' = a'·cos(a), we try differentiating sin(nx)
⇥1.4) Let's differentiate: ddx(sin(nx))
⇥Apply the differentiation rule: ddx(sin(f)) = ddx(f)·cos(f) with f = nx
⇥ⓘ The derivative of sin(x) is cos(x): ddx(sin(nx)) = ddx(nx)·cos(nx)
⇥ ddx(nx)·cos(nx)
⇥ⓘ For differentiation with respect to x, n is treated as constant. The derivative of a constant multiple keeps that factor: that of ku is k·u': ddx(nx) = n·ddx(x) = n·1 = n
⇥ n·cos(nx)
⇥The computed derivative matches the original math expression up to a constant factor. Therefore, the integral is:
⇥ⓘ Differentiating 1n·n·sin(nx) gives cos(nx)n, so 1n·n·sin(nx) is an antiderivative of cos(nx)n: -∫(-cos(nx)n)dx = 1n·n·sin(nx)
⇥ -x·cos(nx)n + 1n·n·sin(nx)
⇥ⓘ Multiplying a fraction by a term multiplies its numerator: 1n·n·sin(nx) = 1·sin(nx)n·n = sin(nx)n2
⇥ -x·cos(nx)n + sin(nx)n2
Then you can continue the integration:
ⓘ ∫x·sin(nx)dx = -x·cos(nx)n + sin(nx)n2
-x·cos(nx)n + sin(nx)n2
2) Let's evaluate for the interval [-π, π]: (sin(nπ)n2 -π·cos(nπ)n) -(sin(n·(-π))n2 -(-π·cos(n·(-π))n))
ⓘ With a minus sign before parentheses, change the sign of every term inside: -(sin(n·(-π))n2 -(-π·cos(n·(-π))n)) = -sin(n·(-π))n2 + -π·cos(n·(-π))n
sin(nπ)n2 -π·cos(nπ)n -sin(n·(-π))n2 + -π·cos(n·(-π))n
ⓘ The minus sign is placed in front of the product: n·(-π) = -nπ
sin(nπ)n2 -π·cos(nπ)n -sin(-nπ)n2 -π·cos(-nπ)n
ⓘ sin is odd: sin(-x) = -sin(x): sin(-nπ) = -sin(nπ)■Since cos is even: cos(-x) = cos(x): cos(-nπ) = cos(nπ)
sin(nπ)n2 -π·cos(nπ)n -(-sin(nπ)n2) -π·cos(nπ)n
ⓘ A pair of minus signs cancels out: -(-sin(nπ)n2) = sin(nπ)n2■Group like terms by adding their coefficients: -π·cos(nπ)n -π·cos(nπ)n = -2·π·cos(nπ)n
sin(nπ)n2 -2·π·cos(nπ)n + sin(nπ)n2
ⓘ Multiplying a fraction by a number multiplies its numerator: -2·π·cos(nπ)n = -2π·cos(nπ)n■Group like terms by adding their coefficients: sin(nπ)n2 + sin(nπ)n2 = 2·sin(nπ)n2
2·sin(nπ)n2 -2π·cos(nπ)n
ⓘ Multiplying a fraction by a number multiplies its numerator: 2·sin(nπ)n2 = 2·sin(nπ)n2
2·sin(nπ)n2 -2π·cos(nπ)n
For n = 0, the integrand is identically zero: the integral is 0
▶Integral:   {0ifn = 02·sin(nπ)n2 -2π·cos(nπ)nifn ≠ 0

The 100% free maths solver with steps

100% free

  • Access to every feature and every step
  • Unlimited queries
  • No signup required

Simple

  • Queries in natural language
  • Detailed explanations for every step
  • A simple interface for desktop and mobile

Reliable and lean

  • Fast calculations
  • Reproducible results
  • No AI, low energy use

For everyone

  • Calculation, differentiation, integration, solving, factoring, graphing...
  • Pupils, students, individuals, teachers…
  • Through high school and beyond