Separation of Variables

Learn the separation of variables trick for solving the Laplace equation — assume V = X(x)·Y(y), plug in, and hunt down those coefficients with boundary conditions!

Previously we learned the method of images, one approach (a trick) for solving the Laplace equation.

Well, you could call it a skill,

and now I’ll introduce yet another skill called separation of variables.

Separation of variables works by assuming the function V has the form (a function of x) times (a function of y), and then solving it.

So it’s something where luck has to be on your side.

What if you assume this and try to solve the problem, but it doesn’t work out????

Question marks, finger near chin and strained questioning smile.

Well, that one product might not fit all the boundaries, heh. But don’t give up on the method: we can add many separated solutions, and that’s exactly what we’ll do below.

Let’s begin.

Let’s assume V(x,y) = X(x)·Y(y).

If we plug the assumed V(x,y) = X(x)·Y(y) into the Laplace equation,

Substitution-and-division source image

For two terms with different variables to add up to zero, both terms must be constants!!

If you’ve got an objection to the claim that for (a function of x) + (a function of y) to give a constant, each function must itself be a constant, let’s hear it^^

I’ll call the constant k^2…. (the reason I use a square is to make the calculation easier hehe, you’ll be able to catch why as we go further)

Separated equations with positive k squared for X and negative k squared for Y

If you differentiate “something” twice,

and “something” comes out again, then that something must be of the form e-to-the-x (exponential) or a trig function (sine or cosine).

(The details are actually covered in differential equations ~Introduction to the Differential Equations Special Series (Differential Equations Special #1) )

Linked-post preview thumbnail

Anyway, if I write out the general solution,

Exponential X factor, sine and cosine Y factor, and their product for the two-dimensional potential

You make the general solution like this, and then plug in the boundary conditions one by one to find the coefficients A, B, C, D, k!!! hehehe fun, right!!

Let’s work through an example problem.

Grounded parallel walls at y equals zero and a, with entrance potential V zero of y at x equals zero and the strip extending along positive x

Let’s try using separation of variables under boundary conditions like these!!!

Since we did it in 2D, I brought a problem asking about V(x,y) in 2D too!

Let’s write out the boundary conditions first

  1. V(x,0) = 0

  2. V(x,a) = 0

  3. V(∞,y) = 0

  4. V(0,y) = V_0(y)

Now let’s plug them in one by one~~~~

From boundary condition 1, D=0

From boundary condition 2, Csin(ka) = 0 ☞ ∴k=nπ/a

From boundary condition 3, A=0

We can go up to here. As a result, we couldn’t determine the constants B and C.

Let’s go determine them!

First, if we write V with the constants we’ve determined so far applied,

Equation from the original notes

Now you see why we took X’s general solution as an exponential and Y’s as a trig function, right?

If X had been a trig function, it wouldn’t have been able to make V=0 far away,

and if Y had been an exponential, it wouldn’t have been able to make V=0 at y=a and y=0.

(And there needs to be a condition n≠0 but I forgot to mention it..hehe)

And the reason I restricted n to positive values is that the sign of k flips back and forth, so I just decided on plus or minus either way.!!!

(It’s fine to take it as negative.)

Anyway, we got V’s general solution like that.

How many general solutions does V have?? A ton…

The differential equation we dealt with is a linear one, so it also satisfies linear combination!!!(the sum of solutions is also a solution!)

Let’s do a linear combination and express the many solutions as one.

(For those who want the details, please check the linear algebra post^^ planned for June 2015^^)

Equation from the original notes

Now, if we plug boundary condition 4 — which didn’t get used earlier — into that general solution,

Entrance potential expressed as a Fourier sine series with coefficients C n

Now, how we’re going to cook this equation up is, we’ll use a purely mathematical technique called Fourier’s trick.

We’ll multiply both sides by sin(n’πy/a) and make a term that integrates from 0 to a

(Fourier’s trick is used a lot not just in electromagnetism, but also in thermal/statistical mechanics, quantum mechanics, etc.)

Fourier-coefficient step

Now on the left side, only when n=n’ does it give (a/2), and in all other cases it’s 0, so the left side becomes

0+0+0+0+0+Cn(a/2)+0+0+0+ ···················· so in the end

we get to determine the constant Cn.

Fourier sine coefficient C n equals two over a times the integral of the entrance potential against its sine mode

<Functions whose inner product is zero are said to be orthogonal to each other. (When you view functions as vectors, the inner product is an integral.)>

Even if you don’t know what orthogonal means, you can just integrate and notice that everything except n=m is aaalll 0, so don’t worry about it.

(In linear algebra they cover the inner product of vectors other than spatial vectors.)

Let me solve one more with the Laplace equation in 3D.

Rectangular pipe extending along x, with height a along y, width b along z, four grounded side walls and entrance potential V zero of y and z

Let’s try with boundary conditions like these. Let’s write out the boundary conditions neatly first~

Just from a glance at the picture, you can catch that x should be in exponential form and y, z should be in sine form.

  1. y=0 → V=0

  2. y=a → V=0

  3. z=0 → V=0

  4. z=b → V=0

  5. x→∞ → V=0

  6. x=0 → V=V(y,z)

Three-coordinate separation image

We’ve got the general solution for V(x,y,z).

Product of a longitudinal exponential factor and two transverse sine and cosine factors for the rectangular pipe

Let’s plug in the boundary conditions one by one.

From boundary condition 1, D=0

From boundary condition 2, Csin(ka)=0, so k=nπ/a

From boundary condition 3, F=0

From boundary condition 4, Esin(lb)=0, so l=mπ/b

From boundary condition 5, A=0

Pipe-mode and double-sum image

Now if we plug in the last boundary condition here!!!!!

Entrance potential expanded in a double sine series, with independent y and z mode indices

Do Fourier’s trick for y separately, z separately, go go go go go

Double sine orthogonality calculation and coefficient normalized by four over a b, integrating over y first and z second

And just like that, we’ve found every single constant~~~~ If V0(y,z) happens to be a function that doesn’t depend on y,z,

the next integration step is high-school level, so you can do it easy-peasy!

When I first did this I was like wow….. what the heck is this doing…?

but if you sit down caaalmly and follow it step by step, it’s really not that hard~

This was my midterm range~

and studying this way, I got the top score~ clap clap clap clap~~

I’ve gotta keep studying hard from here on! hehe

Tongue-out character waving both hands playfully.

Heads-up. The figures here are the original notes, slips and all. A few things to watch for:

  • In the figure where we divide both sides by $XY$, the last line should read $\frac{1}{X}\frac{d^2X}{dx^2}+\frac{1}{Y}\frac{d^2Y}{dy^2}=0$. The figure still shows the terms multiplied instead of divided.
  • In the strip figures the exponent is written $e^{-n\pi/a}$. The $x$ went missing: it should be $e^{-n\pi x/a}$.
  • In the three-dimensional separation picture, the constants are attached to the wrong coordinates: for the solutions written immediately below, $X''/X=k^2+\ell^2$, $Y''/Y=-k^2$, and $Z''/Z=-\ell^2$. These add to zero and give the displayed decaying $x$ exponential and two sine factors.
  • In the double-orthogonality picture, the second $z$ sine uses the independent test index $m'$, not $n'$: $\sin(m\pi z/b)\sin(m'\pi z/b)$. The final coefficient $4/(ab)$ is right.

Questions or corrections?

Did a step lose you, or does a number look off? Email me or use the contact page. Include the note title and the step or figure you mean.

Feedback goes to me privately by email; it is not posted as a public comment.