Re: What assumptions to use to check for orthogonality

*To*: mathgroup at smc.vnet.net*Subject*: [mg112915] Re: What assumptions to use to check for orthogonality*From*: Daniel Lichtblau <danl at wolfram.com>*Date*: Tue, 5 Oct 2010 05:38:09 -0400 (EDT)

Nasser M. Abbasi wrote: > This is basic thing, and I remember doing this or reading about it before. > > I am trying to show that Cos[m Pi x], Cos[n Pi x] are orthogonal > functions, m,n are integers, i.e. using the inner product definition > > Integrate[Cos[n*Pi*x]*Cos[m*Pi*x], {x, 0, 1}]; > > So, the above is ZERO when n not equal to m and 1/2 when n=m. hence > orthogonal functions. > > This is what I tried: > > ------ case 1 ------------- > Clear[n, m, x] > r = Integrate[Cos[n*Pi*x]*Cos[m*Pi*x], {x, 0, 1}]; > Assuming[Element[{n, m}, Integers], Simplify[r]] > > Out[167]= 0 > ---------------- > > I was expecting to get a result with conditional on it using Piecewise > notation. > > Then I tried > > ---------case 2 ------------ > Clear[n, m, x] > r = Integrate[Cos[n*Pi*x]*Cos[m*Pi*x], {x, 0, 1}]; > Assuming[Element[{n, m}, Integers] && n != m, Simplify[r]] > > Out[140]= 0 > > Assuming[Element[{n, m}, Integers] && n == m, Simplify[r]] > > Out[184]= Indeterminate > ---------------- > > So, it looks like one has to do the limit by 'hand' to see that for n=m > we get non-zero? > > ------------------- > Clear[n, m, x] > r = Integrate[Cos[n*Pi*x]*Cos[m*Pi*x], {x, 0, 1}]; > Limit[Limit[r, n -> m], m -> 1] > > Out[155]= 1/2 > > Limit[Limit[r, n -> 1], m -> 99] > > Out[187]= 0 > ---------------------------- > > > So, is there a way to get Mathematica to tell me that the integral is > zero for m!=n and 1/2 when n=m? (tried Reduce, Refine). It seems the > problem is that the Integrate is not taking the limit automatically to > determine what happens when n=m? Should it at least in case have told me > that when n!=m it is zero, and when n=m it is Indeterminate? It just > said zero which is not correct when n=m and I did say n,m are integers. > > thanks > --Nasser Here is what I get. In[3]:= r = Integrate[Cos[n*Pi*x]*Cos[m*Pi*x], {x, 0, 1}] Out[3]//InputForm= (m*Cos[n*Pi]*Sin[m*Pi] - n*Cos[m*Pi]*Sin[n*Pi])/(m^2*Pi - n^2*Pi) I am hard pressed to imagine a better result from Integrate. A result littered with Piecewise to handle a non-generic (indeed, discrete) set of values would be a really bad idea. And one that would be quite hard to make work in any general manner. Also observe that the result is (also) nonzero for m = -n and integral. One way to see this is to let m approach -n. In[5]:= Limit[r, m->-n] Out[5]//InputForm= (2 + Sin[2*n*Pi]/(n*Pi))/4 Regarding the result from Simplify, which is (in some sense) generically correct, see: http://forums.wolfram.com/mathgroup/archive/2008/Sep/msg00492.html Daniel Lichtblau Wolfram Research