<<

Lagrangian vs Hamiltonian: The best approach to relativistic orbits Richard H. Price Department of , MIT, 77 Massachusetts Avenue, Cambridge, Massachusetts 02139 Kip S. Thorne California Institute of Technology, Pasadena, California 91125 (Received 28 July 2017; accepted 6 July 2018) In introductory courses, free particle trajectories, such as astronomical orbits, are generally developed via a Lagrangian and variational calculus, so that physical examples can precede the mathematics of tensor calculus. The use of a Hamiltonian is viewed as more advanced and typically comes later if at all. We suggest here that this might not be the optimal order in a first course in general relativity, especially if orbits are to be solved with numerical methods. We discuss some of the issues that arise in both the Lagrangian and Hamiltonian approaches. VC 2018 American Association of Physics Teachers. https://doi.org/10.1119/1.5047439

I. INTRODUCTION AND SUMMARY This short paper is organized as follows: In Sec. II,we briefly review the traditional Lagrangian approach, and in 1 In a recent paper, one of us (KST) described the numeri- Sec. III we outline the Hamiltonian approach. The two meth- cal computation of photon orbits in a wormhole metric to ods are compared in Sec. IV for orbits in a spherically sym- produce images for the science fiction movie Interstellar. metric . We conclude and summarize in Sec. V.In That description emphasized the convenience of basing the three appendices, we present some details of techniques for on the Hamiltonian rather than the more dealing with singular , and two examples of the traditional Lagrangian-based approach. This relative conve- Hamiltonian approach. nience was rooted in computational difficulties inherent in Throughout this paper we use the notation of the text the traditional approach. Gravitation.2 In particular, we use the sign convention Here, we will compare the two approaches somewhat -þþþ and units in which c ¼ G ¼ 1. more broadly, but not too broadly. We will avoid some of the interesting questions lurking in the background of the II. TRADITIONAL APPROACH: CONSTANTS Hamiltonian-vs.-Lagrangian choice such as the availability OF MOTION AND QUADRATURE of the advanced techniques of canonical transformations, adiabatic invariants, the connection to quantum mechanics, Though a geodesic is best described as a locally straight and thermodynamics, etc. We will be concerned only with spacetime curve, the implementation of that description the Hamiltonian-vs.-Lagrangian choice in computing particle requires a substantial background in the mathematics of and photon orbits in a curved spacetime. curved spacetime: covariant differentiation, Christoffel sym- Below, within that limited scope, we will deal with the fol- bols, etc. Introductory texts, in a hurry to get to the physics lowing claims and will present coupled counterclaims: (i) of orbits, defer the mathematics of curved spacetime by Claim: The Lagrangian formulation allows orbital equations introducing a geodesicÐ as a curve xl(k) that is the extremum to be presented with a minimum of mathematical preliminar- of the action Ldk along the curve, where3,4 ies; this explains why the Hamiltonian approach is not pre- sented in most texts. Counterclaim: we will argue that the 1 L¼ g x_lx_: (1) Hamiltonian approach could be presented with minimal 2 l mathematical foundation; it is simply not the tradition. (ii) Claim: The Hamiltonian approach is superior because it leads Here, x_l dxl=dk, and k is an affine parameter that is typi- to first-order equations of motion that are better for numerical cally taken to be proper s for a particle with nonzero integration, not the second-order equations of the Lagrangian mass m so that x_l ¼ Ul, a component of the particle approach. Counterclaim: The second order ODE could 4-velocity. Equally well, k can be taken to be s/m, so that always be recast as two coupled first-order ODEs; we shall x_l ¼ Pl, a component of the particle 4-momentum. For a demonstrate this explicitly in one of the examples. (iii) photon, the proper time does not exist; k is typically defined Claim: The Hamiltonian approach makes constants of motion so that x_l ¼ Pl, the photon 4-momentum. For uniformity, more apparent. Counterclaim: Without the advanced methods and simplicity, we will let x_l ¼ Pl below, for both massive of Hamiltonian mechanics this is not true (as will be shown and massless particles. in an example in one of the appendices). (iv) Claim: The The equations of motion follow from the Euler-Lagrange equations of motion of the Hamiltonian formulation lack the (EL) equations dL=dxl ¼ 0, that is, singularities that are a difficulty in working with the Lagrangian equations. (This was the primary motive in Ref. 1 d @L @L ¼ : (2) for extolling the Hamiltonian approach.) Counterclaim: As dk @x_l @xl we shall show, the singularities are a consequence of seeking a “solution by quadrature,” and even in the solution by quad- This shortcut to the equations of motion largely explains the rature, it is possible to overcome this difficulty with techni- focus in introductory texts on the Lagrangian-based equa- ques detailed in another of the Appendixes. tions of motion.

678 Am. J. Phys. 86 (9), September 2018 http://aapt.org/ajp VC 2018 American Association of Physics Teachers 678 The most typical example used in texts is orbits in a spher- as the trajectory parameter, and to define the “canonical l ically symmetric static spacetime; the wormhole metric in momenta” by Pl @L=@x_ . Ref. 1 is of this type. We will use this typical case to illus- When we apply this procedure to the expression in Eq. trate the traditional approach. That approach uses standard (1), changing notation mutatis mutandis, we find that the spherical polar coordinates5 t, r, h, /. Since neither t nor / canonical momenta are simply the covariant components of appears in the metric coefficients, the EL equations tell us the particle 4-momentum, and the Hamiltonian is _ that @L=@t_ ¼ Pt and @L=@/ ¼ P/ are constants. Following @L tradition, we call these, respectively—E and Lz; they are con- H¼x_a L; (4) stants of motion and they show up just as directly in the @x_a Lagrangian approach as in the Hamiltonian. In the traditional (Lagrangian) approach, we combine where now, as usual, summation over repeated indices is a a ab these two constants with a third constant of motion, the value assumed. With L given in Eq. (1) and x_ ¼ P ¼ g Pb,we of L itself. It is constant since, by Eq. (1), L is just half the can write the Hamiltonian in the useful form square of the mass of the particle whose trajectory is being 1 l computed. We exploit symmetry to take the orbital plane to H¼ g PlP; (5) be the equatorial plane, so that h ¼ p/2 is, in a sense, another 2 constant of motion. With this set of four constants we find, and we have what we need for Hamilton’s equations of as closed form functions of r, the first derivatives dr/dk, dt/ motion dk, d//dk with the fourth coordinate h constant at p/2. These first integrals are then solved for the trajectory, i.e., for t, r, h l dPl @H dx @H and / as functions of k, by integrating. One says the orbit ¼ ¼ : (6) dk @xl dk @P has been solved by, or reduced to “quadrature,” a somewhat l old-fashioned name for integration. One of the points that we most want to emphasize is that The reduction of a problem to an integral has many advan- the Hamiltonian (5) does not have to be introduced via the tages. Often an integral is easier to evaluate numerically than Lagrangian, as above. The right hand side of Eq. (5), aside the solution of coupled differential equations. The integral from an irrelevant factor of 1/2, is simply the square of the also has the advantage of showing the whole solution “at total rest-mass-energy of a particle. Students are almost as once,” rather than showing a step-by-step process. This can likely to have been exposed to the basic Hamilton equations be valuable for seeing the dependence on parameters, the location of turning points, etc. of motion as to EL variation. Introducing Eq. (5) as the rela- What are the disadvantages of this traditional method, dis- tivistic extension of the Newtonian particle energy “T þ V” advantages that might push us to investigate the Hamiltonian is therefore about as palatable as the variational principle for alternative? A consideration—not a disadvantage per se—is orbital equations of motion. that the numerical solution of differential equations is no lon- Let us now compare the relativistic mathematical prelimi- ger a barrier; computation is part of a physics curriculum. A naries necessary for introducing equations of motion in the real disadvantage, specific to orbits, is that the quadrature Hamiltonian vs. Lagrangian formalism in a beginning course. integrals have singularities. These singularities are integra- For the Lagrangian approach, the student needs to have only ble, but lead to sign changes at orbital turning points that are the concept of a line element written in a coordinate basis, cumbersome in numerical work. For tasks such as the ray i.e., the metric expression; cf. Eq. (1). For the Hamiltonian approach, the student also needs the contravariant components tracing in Ref. 1 one also wants photon orbits, in many dif- l ferent planes, and one does not want to have to transform g of the gl, and how to raise and lower indi- back and forth between the working coordinate frame and ces with these objects; cf. Eq. (5). We believe that the student the frame in which the equatorial plane is the orbital plane cannot help but learn these elements early on in any case, so for each photon being considered. that the argument is weak that the Lagrangian approach is Appendix A gives some details of these inconveniences. It favored in an introductory course. Although some might make also shows how they can be overcome. The attraction of the that argument, there can be no question that neither approach Hamiltonian approach then is not so much that it is needed, requires the mathematics of curved spacetime. but that it is simple and has no such disadvantages. IV. COMPARISON OF EQUATIONS OF MOTION III. THE HAMILTONIAN APPROACH: COVARIANT To understand how the two methods differ in actual usage, MOMENTA let us take, again, the paradigmatic example of motion in a The standard path from a Lagrangian formalism to a static spherical spacetime. With the radial coordinate taken Hamiltonian formalism starts with the Lagrangian viewed as to be the usual “areal” radius, we will write the metric as a function of q , and their derivatives j ds2 ¼AðrÞdt2 þ BðrÞdr2 þ r2ðdh2 þ sin2 hd/2Þ: (7) q_ j with respect to a trajectory parameter, and with the intro- duction of the Hamiltonian The Lagrangian approach starts with X @L H¼ q_ L: (3) 1 2 2 2 j @q_ L¼ At_ þ Br_2 þ r2h_ þ r2 sin2 h/_ : (8) j j 2 The second step is to consider the spacetime coordinates to Following the traditional approach and specifying that our be the generalized coordinates, to take the affine parameter k particle is a photon (so that L¼0), we arrive at

679 Am. J. Phys., Vol. 86, No. 9, September 2018 R. H. Price and K. S. Thorne 679 1 1 dr 2 1 value of the Lagrangian) makes the solution more difficult, 0 ¼ E2 þ þ L2; (9) but the difficulty is only a technical one associated with a A B dk r2 z quest for quadrature. at which point, or soon after, we exclaim “solved by The Hamiltonian approach does have an advantage in that it works from the outset with the canonical momenta; they do quadrature.” l The Hamiltonian approach starts by identifying the non- not have to be constructed (as @L=@x_ ) in the Lagrangian pro- zero elements of the inverse metric cess. This difference is trivial for diagonal metrics. For met- rics that are not diagonal, the Hamiltonian approach can result 1 1 1 1 in considerable simplification. We give such an example in gtt ¼ grr ¼ ghh ¼ g// ¼ ; (10) A B r2 r2 sin2 h Appendix C. The use of canonical momenta at the outset, however, should not be misinterpreted as aiding the identifica- with which the Hamiltonian [Eq. (5)] becomes tion of constants of motion. Appendix B presents an example in which the symmetry is hidden in both approaches. 1 1 1 1 1 H¼ P2 þ P2 þ P2 þ P2 : (11) 2 A t B r r2 h r2 sin2h / V. CONCLUSION

With h fixed at p/2 the equations of motion for this The traditional (Lagrangian) approach to the equations of Hamiltonian are motion in general relativity is founded on the path of least required mathematics; the student needs to have experience dP dt P only with standard variational calculus. We have shown that t ¼ 0 ) P E; ¼ t ; (12) dk t dk A this method is adequate, but a perhaps better (Hamiltonian) method requires perhaps less mathematics of a student; a stu- dP/ d/ P/ dent must only accept that it is the covariant components of ¼ 0 ) P L ; ¼ ; (13) dk / z dk r2 particle 4-momentum that are the canonical momenta for the equations of motion. The only remaining step is to take the dP 1 d 1 d 1 2 r ¼ E2 þ P2 L2 ; Hamiltonian to be half the square of the 4-momentum, the dk 2 dr A dr A r r3 z negative of the squared particle mass, a constant which is an dr P acceptable, perhaps compelling, if not obvious, generaliza- ¼ r : (14) dk B tion of the constant “energy” for a nonrelativistic system. The resulting Hamiltonian approach simplifies both numeri- The central difference of the two methods lies in the com- cal and analytical work with the equations of motion. parison of Eqs. (14) and (9) for r(k). The first is a pair of cou- pled first order differential equations with no obvious singularities; the second is a single first order equation with APPENDIX A: DIFFICULTIES AND REMEDIES singularities at turning points. The first pair of equations is IN THE TRADITIONAL APPROACH very well suited to solution for Pr(k) and r(k) by straightfor- Because the first derivative dr/dk occurs quadratically in ward numerical methods for ordinary differential equations. Eq. (1), the expression for dr/dk contains a square root, and The second method leads to an integral that can be evaluated the square root changes sign at “turning points,” values of r numerically but not with straightforward methods (see at which dr/dk ¼ 0. The quadrature for solving for r(k) [more Appendix A). precisely for k(r)] will therefore have the form It is important to notice that Eq. (14) can be extracted from ð the Lagrangian method as well as from the Hamiltonian r dr0 method. The EL equation from Eq. (8), for the r variable, is k ¼ 6 pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi : (A1) 0 E VrðÞ d 1 dA dB 2 ðÞ_ _2 _2 2 Br ¼ t þ r þ 3 Lz : (15) Typically one divides dr/dk by d//dk to eliminate the unnec- dk 2 dr dr r essary reference to k and solves for the orbital shape r(/) / / If we add to this the definition in the second part of Eq. (14), [more accurately for (r)]. The resulting integral for has the same form as in Eq. (A1). the result (with t_ and /_ eliminated in favor of E and L )is z The integral in Eq. (A1) may have one or two turning just the first part of Eq. (14). Notice that we can define points. (That is, the expression inside the square root may w Bdr/dk, without any guidance from the fact that it is Pr, and write have one or two first-order zeros.) The two-turning-points case occurs for bound orbits. Let us call these turning points dw 1 A B 2 dr w r1 and r2 > r1. We can then write the quadrature as ¼ ;r E2 þ ;r w2 þ L2 ¼ : (16) dk 2 A2 B2 r3 z dk B ð r dr0 k ¼ 6 pffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi : (A2) 0 0 0 We have arrived at the Hamilton equations without the ðÞr2 r ðÞr r1 SrðÞ Hamiltonian approach. An important point to note here is that the solution of Here, the function S is taken to be positive on the interval these Lagrangian-based equations does not involve dealing r1 r r2. Though the integral in Eq. (A2) is finite, evalua- with any singularities. The singularities appear only when tion of the integral with a standard method, e.g., Simpson’s the value of the Lagrangian is added as an additional con- rule, will generally involve evaluating the integrand at points straint in order to arrive at a “solution” by quadrature. It at which the denominator vanishes. A student encountering seems counterintuitive that adding information6 (the constant such an integrand might try to take very small integration

680 Am. J. Phys., Vol. 86, No. 9, September 2018 R. H. Price and K. S. Thorne 680 0 intervals Dr , in the neighborhood of the singularities, but is a constant of motion, i.e., dPcons/ds ¼ 0. Thus this constant any such approach involves unnecessarily large truncation can be used to eliminate (say) Pv in Eq. (B4) and in the equa- errors for a given Dr0, and requires dealing with the sign tions for du/ds and dv/ds. changes in Eqs. (A1) and (A2). It is not a coincidence that dPcons/ds ¼ 0 is a constant. In There are much more efficient ways to handle the singu- terms of new coordinates larities.7 The simplest is to make the substitution x ¼ a cosh u cos v y ¼ a sinh u sin v (B7) r r r þ r r0 ¼ 2 1 cos n þ 2 1 ; (A3) 2 2 the u, v part of the metric is transformed according to ð n ðÞr dn a2ðsinh2 u þ sin2 vÞðdu2 þ dv2Þ!dx2 þ dy2; (B8) k ¼ 6 pffiffiffiffiffiffiffiffiffiffi ; (A4) SðÞn which in turn can be transformed to the two-dimensional flat which has no singularities. [In the case of a single zero, say metric in plane polar coordinates r, /. The constant of motion P is in fact just P , which we know to be a con- at r ¼ r1, in the square root, as there would be for a hyper- cons / 2 stant by symmetry. bolic orbit, the transformation r ¼ r1 þ n converts the prob- lem to one with the form of Eq. (A4).] The singularity is thus eliminated, costing only the additional computational over- APPENDIX C: EXAMPLE 3: HAMILTONIAN head of inverting Eq. (A3). APPROACH WITH A NON-DIAGONAL METRIC In addition to the problem with turning points, the second inconvenience of the traditional approach to orbits is the As an example, we consider trajectories t(k), x(k) in the yz need to have the photon orbit always in the equatorial plane. plane of the spacetime with a metric This is simple to eliminate. One removes the choice h ¼ p/2 2 2 and replaces it with the constant of motion 2 dt 2xdxdtþ dx 2 2 ds ¼ 2 þ dy þ dz ; (C1) 2 2 2 1 þ x L ¼ ph þ Lz= sin h: (A5) for which the Lagrangian is With this fourth general constant,8 motion in any plane is ! reduced to quadrature. 1 t_2 2xt_x_ þ x_2 L¼ : (C2) 2 1 þ x2 APPENDIX B: EXAMPLE 2: HIDDEN SYMMETRY (This metric has no physical importance that we know of, We demonstrate here that constants of motion may not be but is contrived to lead to a closed form solution.) obvious, in either the Lagrangian or the Hamiltonian formal- Since t is an ignorable coordinate we know that there is a ism. Let us consider the spacetime metric conserved momentum Pt. This turns out to be ds2 ¼e2Udt2 þ a2ðsinh2 u þ sin2 vÞðdu2 þ dv2Þþdz2; t_ þ xx_ P ¼ ; (C3) (B1) t 1 þ x2 where a is a constant and U is a function only of z. The where a dot signifies d/dk. The EL equation dð@L=@x_Þ=dk Hamiltonian for this spacetime is ¼ @L=@x gives us "# d xt_ þ x_ x_t_ 1 P2 þ P2 ¼ H ¼ e2UP2 þ u v þ P2 : (B2) dk 1 þ x2 1 þ x2 2 t 2ðÞ2 2 z ÀÁ a sinh u þ sin v x t_2 2xt_x_ þ x_2 : (C4) ðÞ2 2 Two of the equations of motion are simple 1 þ x Equation (C4) can be converted to a differential equation for dPz 2U 2 Pt ¼ constant ¼U;ze P : (B3) x(t), by using d=dk ¼ td_ =dt, and by eliminating t_ with the ds t use of Eq. (C3). While this is possible in principle, it is quite tedious, so it The equations for Pu, Pv are not simple is interesting to see how this compares with the tedium of dP 1 ÀÁ@ 1 the Hamiltonian approach. The extra effort9 in that approach u ¼ P2 þ P2 (B4) ds a2 u v @u sinh2 u þ sin2 v goes into finding the components of the inverse metric, the gl, which, for the metric of Eq. (C1), are gxx ¼ gyy ¼ gzz tt xt dP 1 ÀÁ@ 1 ¼g ¼ 1 and g ¼x. The Hamiltonian for motion in the v ¼ P2 þ P2 : (B5) yz plane is therefore ds a2 u v @v sinh2 u þ sin2 v 1 ÀÁ H¼ P2 2xP P þ P2 : (C5) It turns out, however, that the combination 2 t x t x sin v cos v Pu þ sinh u cosh uPv We rather easily get the following Hamilton equations in Pcons 2 2 (B6) sinh u þ sin v which, of course, Pt is a constant:

681 Am. J. Phys., Vol. 86, No. 9, September 2018 R. H. Price and K. S. Thorne 681 dP dx dt 4It can be argued (quite correctly) that the right form of the Lagrangian x ¼ P P ; ¼ P xP ; ¼P xP : (C6) dk t x dk x t dk t x should be the square root of the negative of the expression in Eq. (1). In the interest of simplicity we are cutting a corner here. It can be shown without too much difficulty that either form of the Lagrangian The explicit solutions follow immediately: gives the same equations of motion if the Lagrangian itself has a con- a stant value for the solution. In the case of an affine parameter, which is Ptk Ptk Ptk Px ¼ ae ; x ¼ e þ be ; the case that we consider, the Lagrangian is a constant for the solution 2Pt curve. 2 5For the wormhole of Ref. 1 the radial coordinate is ‘, not r. a 2 k Pt 6When we add the information that the Lagrangian is constant, we are actu- t ¼ðÞPt þ ab k þ t0 2 e : (C7) 4Pt ally modifying the problem. Without this the curve parameter k is uncon- strained; when we specify that the Lagrangian we are constraining k to be Here, a, b, and t0 are constants, and are constrained by an affine parameter. 7The integral can be evaluated with good accuracy through the use of 1 Gauss-Chebyshev integration, but this is not familiar to most under- H¼ P ðÞP þ 2ab ¼ 0 (C8) 2 t t graduates and has no real advantage over the substitution presented here. 8 2 if the particle is a photon. The “constant of motion” L is a true integral of motion, so relativistic orbits in a spherical spacetime have a full complement—four—of first inte- grals. Interestingly, L2 can be generalized to “the Carter constant,” for the 1 O. James, E. von Tunzelmann, P. Franklin, and K. S. Thorne, “Visualizing Kerr , which is not spherically symmetric. See B. Carter, “Global interstellar’s wormhole,” Am. J. Phys. 83(6), 486–499 (2015). structure of the Kerr family of gravitational fields,” Phys. Rev. 174(5), 2 C. W. Misner, K. S. Thorne, and J. A. Wheeler, Gravitation (W. H. Freeman, 1559–1571 (1968); Ref. 2, Sec. 33.5. San Francisco, 1973); reprinted by Princeton University Press, 2017. 9With modern symbolic manipulation packages this effort is much easier 3 l The factor of 1/2 is included so that the quantities @L=@x_ agree with the than it had formerly been, adding another consideration in favor of the l usual meaning of the component P of the 4-momentum. Hamiltonian approach.

682 Am. J. Phys., Vol. 86, No. 9, September 2018 R. H. Price and K. S. Thorne 682