Use the package IntroToSymmetry.m to work out the point group of of the linear 2rd order ODE

Xtt+X=0.

The function SolveDeterminingEquations will only find the groups corresponding to translational invariance in time and dilational invariance in X. Mathematica built-in functions are used to simplify the determining equations and find the remaining groups that depend in Sines and Cosines of time. For further information the user should see the 1976 paper by C. E. Wulfman and B. G. Wybourne entitled "The Lie group of Newton's and Lagrange's equations for the harmonic oscillator" in J. Physics A: Math. Gen., Vol. 9, No. 4.

Off[General::spell]

Clear all symbols in the current context.

ClearAll[Evaluate[Context[]<>"*"]]

First read in the package which is located in User Home Folder/Library/Mathematica/Applications/SymmetryAnalysis.

Needs["SymmetryAnalysis`IntroToSymmetry`"]

Enter the input equation as a string, ie, in quotes.

inputequation=
"D[x[t],t,t]+x[t]";

The function x[t] is a solution of the equation and this constraint must be applied to the invariance condition. Replace the second derivative wherever it appears in the invariance condition.

rulesarray=
{"D[x[t],t,t]->-x[t]"};

Enter the list of independent variables.

independentvariables={"t"};

Enter the list of dependent variables.

dependentvariables={"x"};

Enter the list of function and constant names that must be preserved when the equation is expressed in terms of generic (x1,y1) variables.

frozennames={""};

Enter the maximum derivative order of the equation.

p=2;

The maximum derivative order that the infinitesimalsare assumed to depend on is specified by the input parameter r. This parameter is only nonzero when the user is looking for Lie contact groups or Lie-Backlund groups. For the usual case where one is searching for point groups one sets r=0.

r=0;

When searching for Lie-Backlund groups (r=1 or greater) one can, without loss of generality, leave the independent variables untransformed. The corresponding infinitesimals (the xse's) are set to zero by setting xseon=0. If one is searching for point groups then set xseon=1. The choice xseon=1 is also an option when looking for Lie-Backlund groups and this can be useful when looking for contact symmetries.

xseon=1;

When searching for Lie-Backlund groups, it is necessary to differentiate the input equation r times producing derivatives of order p+r. These higher order differential consequences are appended to the set of rules applied to the invariance condition. This process is carried out automatically when internalrules=1. For point groups the equation or equation system is the only rule or set of rules needed and one sets internalrules=0.

internalrules=0;

Now work out the determining equations of the Lie point group that leaves the equation  invariant. The output is available as a table of strings called zdeterminingequations.

Timing[FindDeterminingEquations[
independentvariables,dependentvariables,frozennames,p,r,xseon,inputequation,rulesarray,internalrules]]

equationgenericvariables

invarconditiontable

Here are the determining equations in a readable form as expressions rather than strings.

zdeteqns=ToExpression[zdeterminingequations]

Here is the correspondence between z-variables and conventional variables.

ztableofrules

Now solve the determining equations in terms of multivariable polynomials of some selected order. The Mathematica function Solve uses Gaussian elimination to solve a large number of linear equations for the polynomial coefficients.  The time roughly follows

time/timeref=((number of equations)/(number of equationsref))^n

where the exponent is between 2.4 and 2.7. The Mathematica function Timing outputs the time required for the SolveDeterminingEquations function to execute.

Timing[SolveDeterminingEquations[
independentvariables,dependentvariables,r,
xseon,zdeterminingequations,order=3]]

Here are the infinitesimal transformation functions for the independent variables.

xsefunctions

and for the dependent variables.

etafunctions

Express the xse functions in terms of x,y variables.

ToExpression[xsefunctions]/.ztableofrules

Express the eta function in terms of these variables.

ToExpression[etafunctions]/.ztableofrules

Here is a list of the various infinitesimal groups.

infinitesimalgroupsxy=infinitesimalgroups/.{z1->t,z2->x}

Column[infinitesimalgroupsxy]

The final result indicates that the equation is invariant under two groups. The parameter a10 corresponds to a translation group in time and the parameter b14 represents a dilation in y. Now generate the commutator table.

MakeCommutatorTable[independentvariables,dependentvariables,infinitesimalgroupsxy]

Put the commutator table in readable form.

MatrixForm[commutatortable]

This is an Abelian Lie algebra. The equation admits more groups than this and we need to use Mathematica built-in functions to simplify the determining equations and try various approaches.

Try a solution of the determining equations of the following form.

xse1[t_,x_]:=fa[x]*Cos[t]

eta1[t_,x_]:=ga[x]*Sin[t]

determiningequationsxta=zdeteqns/.{z1->t,z2->x}

This system is solved by (fb[x], gb[x])=(-x, 1+x^2), (x, 1-x^2).

Now try a solution of the determining equations of the form.

xse1[t_,x_]:=fb[x]*Sin[t]

eta1[t_,x_]:=gb[x]*Cos[t]

determiningequationsxtb=zdeteqns/.{z1->t,z2->x}

This system is solved by (fb[x], gb[x])=(x, 1+x^2), (-x, 1-x^2). Note the sign change compared to the first case.

Next try a solution of the determining equations of the form.

xse1[t_,x_]:=fc[x]*Sin[2*t]

eta1[t_,x_]:=gc[x]*Cos[2*t]

determiningequationsxtc=zdeteqns/.{z1->t,z2->x}

This system is solved by fc[x]=1, gc[x]=x.

And finally try a solution of the determining equations of the form.

xse1[t_,x_]:=fd[x]*Cos[2*t]

eta1[t_,x_]:=gd[x]*Sin[2*t]

determiningequationsxtd=zdeteqns/.{z1->t,z2->x}

This system is solved by fd[x]=1, gd[x]=-x. Finally the full set of groups is

infinitesimalgroupsxyall=Column[{{{1},{0}}, {{0},{x}}, {{-x*Cos[t]},{(1+x^2)*Sin[t]}}, {{x*Cos[t]},{(1-x^2)*Sin[t]}}, {{x*Sin[t]},{(1+x^2)*Cos[t]}}, {{-x*Sin[t]},{(1-x^2)*Cos[t]}}, {{Sin[2*t]},{x*Cos[2*t]}}, {{Cos[2*t]},{-x*Sin[2*t]}}}]

MatrixForm[%]

Check that these symmetries satisfy the determining equations.

Clear[xse1,eta1]

xse1[z1_,z2_]:=a10-a12*z2*Cos[z1]+a13*z2*Cos[z1]+a14*z2*Sin[z1]-a15*z2*Sin[z1]+a16*Sin[2*z1]+a17*Cos[2*z1]

eta1[z1_,z2_]:=b11*z2+a12*(1+z2^2)*Sin[z1]+a13*(1-z2^2)*Sin[z1]+a14*(1+z2^2)*Cos[z1]+a15*(1-z2^2)*Cos[z1]+a16*z2*Cos[2*z1]-a17*z2*Sin[2*z1]

ToExpression[zdeterminingequations]

Simplify[%]

The harmonic oscillator admits an 8-dimensional Lie algebra.

MakeCommutatorTable[independentvariables,dependentvariables,infinitesimalgroupsxyall]

Put the final commutator table in readable form.

MatrixForm[Simplify[commutatortable]]