# Answer in Calculus for Leela #206786

Find Fourier series expansion for the function f(x)={x+4 for 0<x<π,-x-π for -π<x<0}

f(x)={x+4 for 0<x<π,

-x-π for -π<x<0}

The Fourier series expansion of any function f(x) is given by

f(x) = “dfrac{ a_0}{2}” + “a_1 cosx” + “a_2 cos2x” + …….. + “b_1 sin x + b_2 sin 2x” + ………… (1)

where,

a_{0 } = “dfrac{1}{pi}” “int_{-pi}^pi” f(x) dx

a_{0} = “dfrac{1}{pi}” (“int^0_{-pi}” ( – x – “pi” ) dx + “int^pi_{0}” (x + 4))dx

a_{0 } = “dfrac{1}{pi}”[ “(dfrac{-x^2}{2} – 4x)_{-pi}^0” +“(dfrac{x^2}{2} + 4x)^pi_0” ]

a_{0} = “pi” …………………………………….(2)

a_{n} = “dfrac{1}{pi}” “int_{-pi}^pi” f(x) cos nx dx

a_{n } =_{ }“dfrac{1}{pi}” (“int^0_{-pi}” ( – x – “pi” ) dx + “int^pi_{0}” (x + 4)) cos nx dx

a_{n} = “dfrac{1}{pi}” “(dfrac{(-x-pi) sin nx}{n} – dfrac{cos nx}{n^2})^0_{-pi}” + “(dfrac{(x + 4)sin nx}{n^2} + dfrac{cos nx}{n^2})^pi_0”

a_{n} = “dfrac{(-1)^n – 1}{pi*n^2}” ………………………………………..(2)

From equation(2) we have

a_{1} = “dfrac{-2}{pi}” , a_{2} = 0 , a_{3} = “dfrac{-2}{9pi}”

b_{n} = “dfrac{1}{pi}” “int_{-pi}^pi” f(x) sin nx dx

b_{n } =_{ }“dfrac{1}{pi}” (“int^0_{-pi}” ( – x – “pi” ) dx + “int^pi_{0}” (x + 4)) sin nx dx

b_{n} = “dfrac{1}{pi}” “(dfrac{(-x-pi) sin nx}{n} – dfrac{cos nx}{n^2})^0_{-pi}” + “(dfrac{(x + 4)sin nx}{n^2} + dfrac{cos nx}{n^2})^pi_0”

b_{n} = “dfrac{1}{npi}” “[pi(1 + (-1)^n – 4(1 – (-1)^n)]” ……………………….(3)

From equation (3) we have

b_{1} = “dfrac{-8}{pi}” , b_{2} = 1 , b_{3} = “dfrac{-8}{3pi}”

**f(x) = **“dfrac{pi}{2}”** + **“dfrac{-2cos x}{pi} + dfrac{-2cos3x}{9pi}”** + ……… + **“dfrac{-8 sin x}{pi} + sin 2x + dfrac{-8 sin 3x}{3pi}”** + ……..**