# Strange behavior of FourierSinCoefficient

FourierSinCoefficient works normally like this and the result is checked with Integrate.

FourierSinCoefficient[Sin[2x], x, n]
(*  DiscreteDelta[-2 + n] *)

Integrate[2/Pi Sin[2x] Sin[2x], {x, 0, Pi}]
(*  1   *)


Q. Another try is in a stange behavior. I expect the following result is made with ConditionalExpression or Piecewise But that is 0 without n.

FourierSinCoefficient[(Sin[x] + Sin[2x]), x, n]
(*  0   *)


I think that's result might be Piecewise[{{1, n == 1 || n == 2}, {0, True}}].

Contrastively, FourierCoefficient works normally like this.

FourierCoefficient[(Sin[x] + Sin[3 x]), x, n]

(* Piecewise[{{-I/2, n == 1 || n == 3},{I/2, n == -3 || n == -1}}, 0] *)

• When I evaluate Integrate[(2/Pi) Sin[2*x] Sin[n*x], {x, 0, Pi}], I get: $$\frac{4 \sin (\pi n)}{\pi \left(n^2-4\right)}$$. (Mathematica 10.0.2) – Mahdi Jun 23 '15 at 17:34
• @Mahdi yes Q2 is my mistake:) sorry. – Junho Lee Jun 23 '15 at 21:56

I'm not sure if this helps. I think the problem can be traced back to this simple case.

Let

f[n_] := Sin[n \[Pi]]/(\[Pi] n)


This should Simplify[] to DiscreteDelta[n]. But at least I have found no way to accomplish this.

Let us investigate the function.

For Mathematica f[n] it is zero for any integer because of the Sin:

Simplify[f[n], n \[Element] Integers]

(* Out= 0 *)


The case n==0 has slipped through.

For n->0 we have

f


During evaluation of In:= Power::infy: Infinite expression 1/0 encountered. >> During evaluation of In:= Infinity::indet: Indeterminate expression 0 ComplexInfinity encountered. >>

(* Out= Indeterminate *)


So we have to take the limit

Limit[f[n], n -> 0]

(* Out= 1 *)


Relevant in the present case is

c[n_, a_] = FourierSinCoefficient[Sin[a x], x, n]

(*
Out= (2 (-1)^n n Sin[a \[Pi]])/(a^2 \[Pi] - n^2 \[Pi])
*)


For integers a and n this should Simplify[] to DiscreteDelta[n-a]. But again, it doesn't.

But the value is infact DiscreteDelta[n-a]

Table[{aa,
Limit[Table[{DiscreteDelta[n - aa], c[n, a]}, {n, 1, 3}], a -> aa]}, {aa, 1, 3}]

(* {
{1, {{1, 1}, {0, 0}, {0, 0}}},
{2, {{0, 0}, {1, 1}, {0, 0}}},
{3, {{0, 0}, {0, 0}, {1, 1}}}
} *)