Calculation of the nth derivatives of eaxcos(bx) and eaxsin(bx)

Two approaches of calculating the nth derivatives: complex analysis and linear algebra techniques.
Author

Yevgen Ryeznik

Published

August 24, 2022

Problem formulation

Given functions g1(x)=eaxcos(bx) and g2(x)=eaxsin(bx), calculate dndxng1(x) and dndxng2(x), n=1,2,.

Complex analysis approach

Let us consider a function f(x)=e(a+ib)x:

f(x)=eaxeibx=eax(cos(bx)+isin(bx))==eaxcos(bx)+ieaxsin(bx)==g1(x)+ig2(x)dndxnf(x)=dndxng1(x)+idndxng2(x)dndxng1(x)=Re(dndxnf(x)),dndxng2(x)=Im(dndxnf(x)).

Here, Re() and Im() are the real and imaginary parts of a complex number.

Then, the nth derivative of f(x) is given by

dndxnf(x)=(a+ib)ne(a+ib)x==[a+ib=reiθ, wherer=a2+b2θ=arg(a+ib)(a+ib)n=rneinθ]==rneinθe(a+ib)x==rneax(cos(nθ)+isin(nθ))(cos(bx)+isin(bx))==rneax((cos(bx)cos(nθ)sin(bx)sin(nθ)cos(bx+nθ))++i(sin(bx)cos(nθ)+cos(bx)sin(nθ)sin(bx+nθ)))==rneaxcos(bx+nθ)+irneaxsin(bx+nθ)dndxng1(x)=dndxn(eaxcos(bx))=rneaxcos(bx+nθ),dndxng2(x)=dndxn(eaxsin(bx))=rneaxsin(bx+nθ),where r=a2+b2,θ=arg(a+ib).

Linear algebra approach

Let us consider another approach that, from my point of view, is less efficient but is quite interesting.

Let us consider a set of all linear combinations of functions g1(x) and g2(x):

S=span(g1(x),g2(x))={f(x)=c1g1(x)+c2g2(x)|c1,c2R}. Then, one may consider an operator T:SR2 such as

f(x)=c1g1(x)+c2g2(x)S,T[f(x)]=(c1c2)T1[(c1c2)]=c1g1(x)+c2g2(x)=f(x).

Now, let us differentiate a function f(x)S:

ddxf(x)=ddx(c1g1(x)+c2g2(x))==c1ddxg1(x)+c2ddxg2(x)==c1ddx(eaxcos(bx))+c2ddx(eaxsin(bx))==c1(aeaxcos(bx)beaxsin(bx))+c2(aeaxsin(bx)+beaxcos(bx))==(ac1+bc2)c~1eaxcos(bx)+(bc1+ac2)c~2eaxsin(bx)==c~1eaxcos(bx)+c~2eaxsin(bx)==c~1g1(x)+c~2g2(x)S.

The latter means that the differentiation operator ddx acts from S to S, ddx:SS, and can be represented as

ddx=T1DT, where D[(c1c2)]=(abba)(c1c2).

Thus, for f(x)=c1g1(x)+c2g2(x)S,

ddxf(x)=(T1DT)[f(x)]=T1[D[T[f(x)]]]==T1[D[(c1c2)]]==T1[(abba)(c1c2)]==T1[(ac1+bc2bc1+ac2)]=T1[(c~1c~2)]==c~1g1(x)+c~2g2(x).

Then,

dndxn[]=ddxddxddx[]n times==(T1DT)(T1=IDT)(T1DT)(T1=IDT)n times=[I is an identity operator]==T1(DD)n timesT==T1DnT,

where operator Dn is represented by Dn, the nth power of matrix D=(abba).

Calculating Dn

If V=(v1v2) is a matrix of eigenvectors of matrix D, and Λ=(λ100λ2) is a matrix of eigenvalues of matrix D, then

D=VΛV1, and Dn=VΛnV1.

Let us calculate eigenvalues λ1, λ2, and eigenvectors v1, v2.

λ1, λ2 are solutions of the equation

det(DλI)=0det(aλbbaλ)=(aλ)2+b2=0{λ1=a+ibλ2=aib Now, let us calculate eigenvectors:

λ1=a+ib,v1=(v11v12), and Dv1=λ1v1av11+bv12=(a+ib)v11bv11+av12=(a+ib)v12|v1=(1i);λ2=aib,v2=(v21v22), and Dv2=λ2v2av21+bv22=(aib)v21bv21+av22=(aib)v22|v2=(i1). Then,

V=(1ii1),Λ=(a+ib00aib),V1=(0.50.5i0.5i0.5)

Dn=VΛnV1=(1ii1)((a+ib)n00(aib)n)(0.50.5i0.5i0.5)==(1ii1)(0.5(a+ib)n0.5i(a+ib)n0.5i(aib)n0.5(aib)n)==((a+ib)n+(aib)n2(a+ib)n(aib)n2i(a+ib)n(aib)n2i(a+ib)n+(aib)n2)==[notice that for r=a2+b2 and θ=arg(a+ib),(a+ib)n=(reiθ)n=rneinθ(aib)n=(reiθ)n=rneinθ|(a+ib)n+(aib)n2=rneinθ+einθ2=rncos(nθ)(a+ib)n(aib)n2i=rneinθeinθ2i=rnsin(nθ)]==(rncos(nθ)rnsin(nθ)rnsin(nθ)rncos(nθ)).

Calculating the nth derivative

Now, we can calculate the derivative of f(x)=c1g1(x)+c2g2(x)S:

dndxnf(x)=dndxn(c1g1(x)+c2g2(x))=c1dndxng1(x)+c2dndxng2(x)==T1DnT[c1g1(x)+c2g2(x)]==T1[Dn[(c1c2)]]==T1[Dn(c1c2)]==T1[(rncos(nθ)rnsin(nθ)rnsin(nθ)rncos(nθ))(c1c2)]==T1[(c1rncos(nθ)+c2rnsin(nθ)c1rnsin(nθ)+c2rncos(nθ))]==(c1rncos(nθ)+c2rnsin(nθ))eaxcos(bx)++(c1rnsin(nθ)+c2rncos(nθ))eaxsin(bx)==c1rneax(cos(bx)cos(nθ)sin(bx)sin(nθ))cos(bx+nθ)++c2rneax(sin(bx)cos(nθ)+cos(bx)sin(nθ))sin(bx+nθ)==c1rneaxcos(bx+nθ)+c2rneaxsin(bx+nθ)dndxng1(x)=dndxn(eaxcos(bx))=rneaxcos(bx+nθ) and dndxng2(x)=dndxn(eaxsin(bx))=rneaxsin(bx+nθ),

which is the same result we obtained with complex analysis approach.