Jackson’s Laplacian in spherical Coordinates [Proof]

If you took a look at one of the previous posts on how to remember the Laplacian in different forms by using a metric,  you will notice that the form of  the Laplacian that we get is:

\nabla^2 \psi = \frac{1}{r^2} \frac{\partial}{\partial r} \left( r^2 \frac{\partial \psi}{\partial r} \right) + \frac{1}{r^2 \sin(\theta)} \frac{\partial}{\partial \theta} \left( sin(\theta)  \frac{\partial \psi}{\partial \theta} \right)   + \frac{1}{r^2 \sin^2(\theta)} \frac{\partial^2 \psi}{\partial \phi^2}   

But in Jackson’s Classical Electrodynamics, III edition he notes the following:


This is an interesting form of the Laplacian that perhaps not everyone has encountered. This can obtained from the known form by making the substitution u = r \psi and simplifying. The steps to which have been outlined below:





Einstein’s field equation from the Action principle

In this post, we will derive the Einstein’s field equation from the least action principle. Let’s just construct an action with the Ricci scalar, Lagrangian and an invariant space-time volume element( \sqrt{g} d^{4}x ; g- metric) : All these quantities  have the same value in all frames of reference.

S = \int R \sqrt{g} d^{4}x  - \int \mathcal{L} \sqrt{g} d^{4}x

\delta S = \int \delta ( R \sqrt{g} )  d^{4}x  - \int \delta  ( \mathcal{L} \sqrt{g} ) d^{4}x  = 0

\delta S = \int \left( \delta ( R  )\sqrt{g} + \frac{\delta g}{2 \sqrt{g}} R  \right) d^{4}x   - \int \frac{1}{\sqrt{g}} \frac{ \delta  ( \mathcal{L} \sqrt{g} )}{ \delta g^{\mu \nu}}  \sqrt{g}  \delta g^{\mu \nu} d^{4}x  


Let’s call \int \frac{1}{\sqrt{g}} \frac{ \delta  ( \mathcal{L} \sqrt{g} )}{ \delta g_{\mu \nu}}  = T_{\mu \nu}    and also subsitute  R = R_{\mu \nu} g^{\mu \nu} in the above equation.

\delta S = \int \left( \delta ( R_{\mu \nu} g^{\mu \nu}  )\sqrt{g} + \frac{\delta g}{2 \sqrt{g}} R \right)   d^{4}x  - \int T_{\mu \nu}\sqrt{g} \delta  g^{\mu \nu}   d^{4}x  

\delta S = \int \left(R_{\mu \nu} \delta (  g^{\mu \nu}  )\sqrt{g}   + \delta(R_{\mu \nu})   g^{\mu \nu} \sqrt{g} + \frac{\delta g}{2 \sqrt{g}} R  - T_{\mu \nu}\sqrt{g} \delta  g^{\mu \nu}   \right)   d^{4}x    .

To simplify further we employ Jacobi’s formula ** \delta g =  -g g_{\mu \nu} \delta g^{\mu \nu} and also note that the boundary terms that arise out of \delta(R_{\mu \nu})  vanish according to Stoke’s theorem.

\delta S = \int \left(R_{\mu \nu} - \frac{ g^{\mu \nu}}{2} R  - T_{\mu \nu} \right) \sqrt{g} \delta (  g^{\mu \nu} ) d^{4}x  = 0   .

This tells us that under a variation of the metric if we would like a stationary action then it has to be true that :

R_{\mu \nu} - \frac{ g_{\mu \nu}}{2} R   =  T_{\mu \nu} 

where R_{\mu \nu} – Riemann Tensor, R – Ricci scalar, T_{\mu \nu} – Energy-momentum Tensor and   g_{\mu \nu} – Metric Tensor

This is the Einstein’s field equation. Inserting the constants at the right places yields the more familiar form:

R^{\mu \nu} - \frac{ g^{\mu \nu}}{2} R   = \frac{ 8 \pi G}{c^4} T^{\mu \nu} 

What would happen ?

As a fun little exercise you can start off with the invariant volume given by the inverse metric instead. i.e \sqrt{g^{-1}} d^{4}x   and you will obtain the same equation. BUT, you should be careful when employing the Jacobi’s formula else you might ending up with a extra minus sign with the Ricci scalar term.

Some more fun questions to ponder:

  •  Why is \sqrt{g} d^{4}x called the  invariant space-time volume element ?
  •  Why is the action defined as S = \int R -  L ? Why not any other way?
  •  How do you prove the Jacobi’s formula ?


Remembering the Laplacian in different coordinate systems

When one is learning about Laplace and Poisson equations it can be frustrating to remember its form in different coordinate systems.  But when one is introduced to four vectors, special relativity and so on, here is a simple way to remember the Laplacian in any coordinate system.

\nabla^2 \phi = \frac{1}{\sqrt{|g|}} \frac{\partial}{\partial x^{j}} \left(\sqrt{|g|} g^{ij}  \frac{\partial \phi}{\partial x^{j}} \right)

where we g^{ij} is the inverse of the metric g_{ij} , |g| is the determinant of the metric . And one specifies the coordinate system by mentioning the form of the metric. Let’s look at how this works out:

Cartesian Coordinates

x^{j} = (x,y,z)

g_{ij} = \begin{bmatrix} 1  &  0 &  0 \\  0 & 1 & 0 \\ 0 & 0 & 1  \end{bmatrix}

g^{ij} = \begin{bmatrix} 1  &  0 &  0 \\  0 & 1 & 0 \\ 0 & 0 & 1  \end{bmatrix}

|g_{ij}| = 1

\nabla^2 \psi = \frac{1}{1} \frac{\partial}{\partial x^{j}} \left(\sqrt{1} g^{ij}  \frac{\partial \psi}{\partial x^{j}} \right)  =  \frac{\partial^2 \psi}{\partial x^2} + \frac{\partial^2 \psi}{\partial y^2} + \frac{\partial^2 \psi}{\partial z^2}


Cylindrical Coordinates

x^{j} = (r,\phi,z)

g_{ij} = \begin{bmatrix} 1  &  0 &  0 \\  0 & r^2 & 0 \\ 0 & 0 & 1  \end{bmatrix}

g^{ij} = \begin{bmatrix} 1  &  0 &  0 \\  0 & \frac{1}{r^2} & 0 \\ 0 & 0 & 1  \end{bmatrix}

|g_{ij}| = r^2

\nabla^2 \psi = \frac{1}{r} \frac{\partial}{\partial x^{j}} \left(r g^{ij}  \frac{\partial \phi}{\partial x^{j}} \right)   

\nabla^2 \psi = \frac{1}{r} \frac{\partial}{\partial r} \left( r \frac{\partial \psi}{\partial r} \right) + \frac{1}{r} \frac{\partial}{\partial \phi} \left( \frac{r}{r^2} \frac{\partial \psi}{\partial \phi} \right)   + \frac{1}{r} \frac{\partial}{\partial z} \left( r \frac{\partial \psi}{\partial z} \right)  

Noting that \frac{\partial r}{\partial \phi}  = 0 = \frac{\partial r}{\partial z}  because they are independent variables, we get

\nabla^2 \psi = \frac{1}{r} \frac{\partial}{\partial r} \left( r \frac{\partial \psi}{\partial r} \right) + \frac{1}{r^2} \frac{\partial^2 \psi}{\partial \phi^2}   + \frac{\partial^2 \psi}{\partial z^2}   


Spherical Coordinates

x^{j} = (r,\phi,\theta)

g_{ij} = \begin{bmatrix} 1  &  0 &  0 \\  0 & r^2 & 0 \\ 0 & 0 & r^2 \sin^2(\theta)  \end{bmatrix}

g^{ij} = \begin{bmatrix} 1  &  0 &  0 \\  0 & \frac{1}{r^2} & 0 \\ 0 & 0 & \frac{1}{r^2 \sin^2(\theta)}  \end{bmatrix}

|g_{ij}| = r^4  \sin^2(\theta)

Following the same approach as the Cylindrical and Cartesian coordinates, we get the following form for the Laplacian in Spherical coordinates,

\nabla^2 \psi = \frac{1}{r^2} \frac{\partial}{\partial r} \left( r^2 \frac{\partial \psi}{\partial r} \right) + \frac{1}{r^2 \sin(\theta)} \frac{\partial}{\partial \theta} \left( sin(\theta)  \frac{\partial \psi}{\partial \theta} \right)   + \frac{1}{r^2 \sin^2(\theta)} \frac{\partial^2 \psi}{\partial \phi^2}   













Observations from Lick Observatory, 2018 [v1.0]

The following are some of the reduced images taken from the Nickel Telescope at  Lick observatory during the graduate workshop conducted in October 2018. The code used for the data reduction has been adapted from the code by Elinor Gates, the staff astronomer at Lick and has been compiled in a Jupyter-notebook.

CodeClick here (Github)

In the v1.0 release, we have taken a look at : M1, M2, M15, M16,  M17, M42, NGC7662, NGC6543 and Saturn from the Nickel@Lick. In addition, the code for data-reduction has been provided in a simple Jupyter-Notebook format. In the next update which is due May 20, 2019 there will be more interesting objects from other telescopes as well and some tutorials on how to perform data reduction on your own. Happy Holidays!

M1 (Crab Nebula)


M2 (Globular cluster)



M15 (Globular cluster)


M16 (Pillars of creation)

M17 (Omega Nebula)

M42(Heart of the Orion Nebula)


NGC6543 (Cat’s eye Nebula)

NGC7662 (Snowball Nebula)




* This is also my first time experience at artistically colorizing data.  It surely was a lot of fun!

Feynman’s trick applied to Contour Integration


A friend of mine was the TA for a graduate level  Math course for Physicists. And an exercise in that course was to solve  integrals using Contour Integration. Just for fun, I decided to mess with him by trying to solve all the contour integral problems in the prescribed textbook for the course [Arfken and Weber’s  ‘Mathematical methods for Physicists,7th edition”  exercise (11.8)] using anything BUT contour integration.

You can solve a lot of them them exclusively by using Feynman’s trick. ( If you would like to know about what the trick is – here is an introductory post) The following are my solutions:

All solutions in one pdf






Arfken-11.8.6 & 7 – not applicable














Arfken-11.8.21 & Arfken-11.8.23* (Hint: Use 11.8.3)








*I forgot how to solve these 4 problems without using Contour Integration. But I will update them when I remember how to do them. If you would like, you can take these to be challenge problems and if you solve them before I do send an email to 153armstrong(at)gmail.com and I will link the solution to your page. Cheers!

Length contraction , Time dilation and Lorentz Transformation: Pokemon edition

 “Most of Special Relatvity is like playing a game of – He said, She said.”

Inspired by the recent Pokemon movie trailer, this post takes you on a journey with Ash and Pikachu  as they find out about the founding principles of special relativity – Length contraction, Time dilation  and Lorentz Transformation.


Time dilation

Let’s consider a scenario where Pikachu is on a  car moving with a velocity v and Ash is standing the ground.


There is a Pokeball on the floor of the car. It is constantly emitting light straight toward the ceiling, Let us try to understand how Ash and Pikachu would see this photon of light from the time it leaves the floor to the ceiling and back, in their respective frame of references:


How pikachu describes the event:

Pikachu only sees the photon bouncing up and down and therefore:

2L  = c t^{'}

4L^2  = c^2 t^{'2}  \rightarrow (1)


How Ash describes the event:

But when the trajectory of the light is viewed from Ash’s frame of reference it is not a straight line at all and therefore, according to Ash:


2 \sqrt{L^{2} + \frac{v^{2}t^{2}}{4}}  = c t

4 L^{2} + v^{2}t^{' 2}  = c^{2} t^{2}

4 L^{2} =  (c^{2} - v^2) t^{2} \rightarrow (2) 

Since both these descriptions of what happened are true and have to agree, we must therefore from (1) and (2) have that,

t = \gamma t^{'}  where \gamma = \frac{1}{\sqrt{1- \frac{v^2}{c^2}}}

This ensures that both the event descriptions are satisfied. The implication being that Pikachu who is on a cart moving with some velocity has to be experiencing time slower than someone who is not moving at all (Ash).


Length Contraction

Consider the same scenario as before except that this time the Pokeball is emitting light along the direction of motion and back.


How Pikachu describes the event:

If the time measured by Pikachu is slower than Ash from the previous analysis, then we expect that the distance traveled by the photon in Pikachu’s frame of reference will not be L . Instead let’s call that distance L^{'} . Therefore,

2L^{'} = c t^{'} 

\frac{2L^{'}}{c} =  t^{'}  \rightarrow (3)


How Ash describes the event:

According to Ash, the photon was initially moving along the direction of motion and then started moving against the direction of motion and therefore the total time taken would be the addition of the time taken in both the cases i.e

\frac{L}{c+v} +  \frac{L}{c-v}  = t

\frac{2L}{1 - \frac{v^{2}}{c^{2}}}  = c t 

\frac{2L}{c} = \left( 1 - \frac{v^{2}}{c^{2}} \right) t

\frac{2L}{c} = \frac{1}{\gamma^2} t 

But, we found from our previous analysis that t = \gamma t^{'}  and

\frac{2L^{'}}{c} =  t^{'}   . Plugging these back into the previous equation gives us:

L = \frac{L^{'}}{\gamma}

The length of the cart as observed by Ash (L ) is shorter than that observed by Pikachu (L^{'} ). This implies that if Pikachu is holding a 1-meter stick,  then Ash would see the 1-meter stick to be shorter than 1-meter. And in general any object that is held parallel to the direction of motion would appear ‘squished’




Lorentz Transformation

Now consider the final scenario where at t=0 , the pokeball is at a distance x from both of them and emits a photon of light. Pikachu decides to move towards the pokeball with a velocity v to catch it before Ash does.

This pulse of light would reach Pikachu when he is at a distance x^{'} from the Pokeball and would reach Ash at a distance x since he is not moving.



Length contraction according to Ash:

Having  understood the concept of Length contraction, Ash would say:

x^{'} = \gamma \left( x - vt \right) \ \ \rightarrow (4)


Length contraction according to Pikachu:

But Pikachu also understands Length Contraction and thinks that he is at rest and it is Ash who is receding backwards. And therefore:

x = \gamma \left( x^{'} +  vt^{'} \right)

We must understand that both are valid representations of  what is happening and must agree. Therefore plugging in (4) into the above equation and performing some simple algebraic manipulations we get,

x = \gamma \left( \gamma \left( x - vt \right) +  vt^{'} \right)

\frac{x}{\gamma^{2}} =  \left( x - vt \right) +  \frac{vt^{'}}{\gamma} 

vt - \frac{v t^{'}}{\gamma} =  x \left( 1 - \frac{1}{\gamma^2} \right) 

vt - \frac{v t^{'}}{\gamma} =  \frac{v^{2} x}{c^{2}} 

t - \frac{t^{'}}{\gamma} =  \frac{v x}{c^{2}} 

t^{'} = \gamma \left( t -   \frac{v x}{c^{2}} \right) \ \ \rightarrow (5)

(4) and (5) are known as Lorentz Transform equations  and relate the distances and time measured in Ash’s reference frame with that measured in Pikachu’s frame.

x^{'} = \gamma \left( x - vt \right)

t^{'} = \gamma \left( t -   \frac{v x}{c^{2}} \right) 

One can start off in Ash’s frame of reference and perform a “Lorentz Boost” to see how things are happening in Pikachu’s frame of reference. Often it is convenient to write them in a matrix form:

\begin{bmatrix} ct^{'} \\ x^{'} \end{bmatrix} = \begin{bmatrix} \gamma  & -\frac{v}{c} \gamma \\  - \frac{v}{c} \gamma & \gamma \end{bmatrix} \begin{bmatrix} ct \\ x \end{bmatrix}

In this post we have constrained Pikachu to move only in the x-direction but this need not be the case. A fun little exercise would be to extend this analysis to Lorentz boosts in 3-dimensions.

It is often more enlightening to see these relations when applied to problems and my personal recommendation would be the book – ‘Spacetime physics by Edwin F. Taylor’. Thank you for joining Ash and Pikachu on this journey. Hope you learned something new. Have fun!




Feynman’s trick of parametric integration applied to Laplace Transforms

Parametric Integration is an Integration technique that was popularized by Richard Feynman but was known since Leibinz’s times. But this technique rarely gets discussed beyond a niche set of problems mostly in graduate school in the context of Contour Integration.

A while ago, having become obsessed with this technique I wrote this note on applying it to Laplace transform problems  and it is now public for everyone to take a look.

( Link to notes on Google Drive ) 

I would be open to your suggestions, comments and improvements on it as well. Cheers!




A note on Wave-functions and Fourier Transforms

In quantum mechanics you can denote the wave-function in the position or the momentum basis. Written in the momentum basis, it would look something like:

|\psi(x)> = a_0 |p_0> + a_1 |p_1> + \hdots

|\psi(x)> = \sum\limits_{n} a_n |p_n>

But momentum is a continuous variable and it varies from -\infty to \infty .


Therefore changing to the integral representation we get that:

|\psi(x)> = \int\limits_{-\infty}^{\infty} dp \ a_n(p) |p>

But a_n(p)  is just the projection of the momentum vector on the wavefunction:

|\psi(x)> = \int\limits_{-\infty}^{\infty} dp <p|\psi(x)>|p>


We are also aware from our knowledge of Fourier Transform* that the wave function written in momentum space is given as :

|\psi(x)> = \frac{1}{\sqrt{2 \pi \hbar}}  \int\limits_{-\infty}^{\infty} dp \  \tilde{\psi}(p) |e^{\frac{ipx}{\hbar}}>

Comparing both the above equations if we take the momentum basis as  |p> = e^{\frac{ipx}{\hbar}} , then:

<p|\psi(x)> = \frac{1}{\sqrt{2 \pi \hbar}} \tilde{\psi}(p)

We can perform a similar analysis by expanding the wavefunction about the position basis and get

<x| \tilde{\psi}(p)> = \frac{1}{\sqrt{2 \pi \hbar}} \psi(x)


** Where does the \frac{1}{\sqrt{2 \pi \hbar}} in the Fourier Transform come from ?

We know from Fourier transform is defined as follows:

|\psi(x)> = \frac{1}{\sqrt{2 \pi}}  \int\limits_{-\infty}^{\infty} dk \  \psi_{1}(k) |e^{ikx}>

Plugging in p = \hbar k and rewriting the above equation we get,

|\psi(x)> = A  \int\limits_{-\infty}^{\infty} dp \  \tilde{\psi}(p) |e^{\frac{ipx}{\hbar}}>

We find that from

\int\limits_{-\infty}^{\infty}  dx <\psi(x)| \psi(x)>  = 1

that the normalization constant is not \frac{1}{\sqrt{2 \pi}} but \frac{1}{\sqrt{2 \pi \hbar}} . Therefore,

|\psi(x)> = \frac{1}{\sqrt{2 \pi \hbar}}  \int\limits_{-\infty}^{\infty} dp \  \tilde{\psi}(p) |e^{\frac{ipx}{\hbar}}>


Cooking up a Lorentz invariant Lagrangian (Part-I)

Let’s consider a scalar field, say temperature of a rod varying with time i.e  T(x,t) . (something like the following)


We will take this setup and put it on a really fast train moving at a constant velocity v (also known as performing a ‘Lorentz boost’).


Now the temperature of the bar in this new frame of reference is given by T^{'}(x^{'}, t^{'}) where,

x^{'}(x,t) = \gamma \left( x - vt \right)

t^{'}(x,t) = \gamma \left( t -   \frac{v x}{c^{2}} \right) 


Visualizing the temperature distribution of the rod under a Length contraction.

Temperature is a scalar field and therefore irrespective of which frame of reference you are on, the temperature at each point on the rod will remain the same on both the frames i.e

T^{'}(x^{'}, t^{'})= T(x, t)

Therefore we can say that Temperature (a scalar field) is Lorentz invariant. Now what other quantities can we make from T that would also be Lorentz invariant ?

Is \nabla . T^{'}(x^{'}, t^{'})= \nabla . T(x, t)  ?

Well, let’s give it a try:

\frac{\partial T}{\partial x}  = \frac{\partial T^{'}}{\partial x^{'}} \frac{\partial x^{'}}{\partial x} + \frac{\partial T}{\partial t^{'}} \frac{\partial t^{'}}{\partial x} 

\frac{\partial T}{\partial x}  = \frac{\partial T^{'}}{\partial x^{'}} \gamma - \frac{\partial T}{\partial t^{'}} \gamma v 

\frac{\partial T}{\partial x}  = \gamma \left(  \frac{\partial T^{'}}{\partial x^{'}}  - \frac{\partial T}{\partial t^{'}} v  \right) 


\frac{\partial T}{\partial t}  = \frac{\partial T^{'}}{\partial x^{'}} \frac{\partial x^{'}}{\partial t} + \frac{\partial T^{'}}{\partial t^{'}} \frac{\partial t^{'}}{\partial t} 

\frac{\partial T}{\partial t}  = -  \frac{\partial T^{'}}{\partial x^{'}} \gamma v  + \frac{\partial T^{'}}{\partial t^{'}} \gamma 

\frac{\partial T}{\partial t}  =  \gamma \left( -  \frac{\partial T^{'}}{\partial x^{'}}  v  + \frac{\partial T^{'}}{\partial t^{'}}  \right)


\frac{\partial T}{\partial x}  +  \frac{\partial T}{\partial t}  \neq   \frac{\partial T^{'}}{\partial x^{'}}  + \frac{\partial T^{'}}{\partial t^{'}}

But just for fun let’s just square the terms and see if we can churn something out of that:

\left( \frac{\partial T}{\partial x} \right)^{2}  = \gamma^{2}  \left(  \frac{\partial T^{'}}{\partial x^{'}}  - \frac{\partial T^{'}}{\partial t^{'}} v  \right)^{2} 

\left( \frac{\partial T}{\partial t} \right)^{2}  =  \gamma^{2} \left( -  \frac{\partial T^{'}}{\partial x^{'}}  v  + \frac{\partial T^{'}}{\partial t^{'}}  \right) ^{2}

We immediately notice that:

\left( \frac{\partial T}{\partial t} \right)^{2} - \left( \frac{\partial T}{\partial x} \right)^{2}  = \gamma^{2} \left[  \left( -  \frac{\partial T^{'}}{\partial x^{'}}  v  + \frac{\partial T^{'}}{\partial t^{'}}  \right) ^{2} - \left(  \frac{\partial T^{'}}{\partial x^{'}}  - \frac{\partial T^{'}}{\partial t^{'}} v  \right)^{2}  \right]

\left( \frac{\partial T}{\partial t} \right)^{2} - \left( \frac{\partial T}{\partial x} \right)^{2}  = \left( \frac{\partial T^{'}}{\partial t^{'}} \right)^{2} - \left( \frac{\partial T^{'}}{\partial x^{'}} \right)^{2} 

Therefore in addition to realizing that T is Lorentz invariant, we have also found another quantity that is also Lorentz invariant. This quantity is also written as \partial_{\mu} T \partial^{\mu} T .

Deeper meaning

S = \int \mathcal{L}( \phi, \partial_{\mu} \phi) dt

We know that nature is relativistic and when we are are cooking up a Lagrangian for a theory, we better make sure that it is Lorentz invariant as well.  What the above analysis on scalar fields hints us is that  the Lagrangian for such a theory can contain terms like \partial_{\mu} \phi \partial^{\mu} \phi in it as the quantity does not change under a Lorentz transformation.

This discussion finds a deeper ground in Quantum Field Theory. For example if \phi is a scalar field, then a Lorentz invariant Lagrangian could take any of the following possible forms:

\mathcal{L} = \phi , \partial_{\mu} \phi \partial^{\mu} \phi, \partial_{\mu} \phi \partial^{\mu} \phi - m^{2} \phi^2 , \partial_{\mu} \phi \partial^{\mu} \phi - m^{2} \phi^2 + g \phi^4, \hdots

All of them keep the action S invariant under a Lorentz transformation.



Euler-Lagrange equations – Field Theory

Consider a function \phi(x) where x is a point in spacetime. If we assume that the Lagrangian is dependent on \phi(x) and its derivative \partial_{\mu} \phi(x) . The action is then given by,

S = \int d^{4}x  \mathcal{L}(\phi(x) , \partial_{\mu} \phi(x)) 

According to the principle of least action, we have:

\delta S = 0 = \int d^{4}x   \delta \mathcal{L}(\phi(x) , \partial_{\mu} \phi(x))

\delta \mathcal{L}(\phi(x) , \partial_{\mu} \phi(x)) = \frac{\partial \mathcal{L}}{\partial \phi} \delta \phi  + \frac{\partial \mathcal{L}}{\partial( \partial_{\mu} \phi)} \delta(\partial_{\mu} \phi)

\delta \mathcal{L}(\phi(x) , \partial_{\mu} \phi(x)) = \frac{\partial \mathcal{L}}{\partial \phi} \delta \phi  + \frac{\partial \mathcal{L}}{\partial( \partial_{\mu} \phi)} \partial_{\mu} (\delta\phi)

According to product rule,

\frac{\partial \mathcal{L}}{\partial( \partial_{\mu} \phi)} \partial_{\mu} (\delta\phi) + \partial_{\mu} \left( \frac{\partial \mathcal{L}}{\partial( \partial_{\mu} \phi)} \right) \delta\phi = \partial_{\mu} \left( \frac{\partial \mathcal{L}}{\partial( \partial_{\mu} \phi)} \delta\phi \right) 


\delta \mathcal{L}(\phi(x) , \partial_{\mu} \phi(x)) = \left( \frac{\partial \mathcal{L}}{\partial \phi} -  \partial_{\mu} \left( \frac{\partial \mathcal{L}}{\partial( \partial_{\mu} \phi)} \right)  \right)\delta \phi  + \partial_{\mu} \left( \frac{\partial \mathcal{L}}{\partial( \partial_{\mu} \phi)} \delta\phi \right) 

\delta S =  \int d^{4}x  \left[  \left( \frac{\partial \mathcal{L}}{\partial \phi} -  \partial_{\mu} \left( \frac{\partial \mathcal{L}}{\partial( \partial_{\mu} \phi)} \right)  \right)\delta \phi  + \partial_{\mu} \left( \frac{\partial \mathcal{L}}{\partial( \partial_{\mu} \phi)} \delta\phi \right) \right] 

The second term in that equation is zero because the end points of the path are fixed i.e


This then leads to the Euler-Lagrange equation for a field as :

\frac{\partial \mathcal{L}}{\partial \phi}  = \partial_{\mu} \left( \frac{\partial \mathcal{L}}{\partial( \partial_{\mu} \phi)} \right)