# Finding the potential of a waveguide with given boundary condition

During the review of some EM exercises I stumbled over a very interesting problem I just can't find the solution for.

Suppose we are looking at a waveguide with side length $$\pi$$. The boundary condition are given as

$$\phi(x,y=\pm\frac{\pi}{2}) = 0$$ $$\phi(x=\pm\frac{\pi}{2},y) = U\cos(y).$$

The potential is constant in $$z$$-direction and inside as well as outside are no further charges. The question is now how the potential looks like inside the area.

My idea was to start with the Laplace-Equation $$\Delta \phi(\vec{r}) = \Delta \phi(x,y) = 0$$

To solve the differential equation I chose to split it into a set of separate equations, however I am not sure if this is a good idea.

I ended with this

$$\Delta \phi(x,y) = X''(x)Y(Y)+X(x)Y''(y) = 0. \tag{1}$$

With that I then said, $$-\frac{X''(x)}{X(x)} = \frac{Y''(y)}{Y(y)} = -\alpha^2,\tag{2}$$

where $$\alpha$$ needs to be constant, otherwise it wouldn't be a solution. I once learned that it is a good idea to choose the constant as $$\alpha^2$$, because it sometimes can make the ansatz easier to handle. I don't know if this is of any significance here, though.

Splitting eq.(2) up into two ODEs gives $$X''(x)+\alpha^2X(x) = 0 \tag{3}$$ $$Y''(y)-\alpha^2Y(y) = 0 \tag{4}$$

And this is basically as far as I come. I would usually continue with choosing ansätze in the form of $$\{\sin(\alpha x), \cos(\alpha x)\}$$ for eq.(3), since it looks like a harmonic equation and $$\{\sinh(\alpha y), \cosh(\alpha y)\}$$ for eq.(4), since it looks like a modified harmonic equation, but I am not able to make it fit with the boundary conditions.

For completeness’s sake my potential would look like

$$\phi(x,y) = A\sin(\alpha x)\sinh(\alpha y) + B\sin(\alpha x)\cosh(\alpha y) + C\cos(\alpha x)\sinh(\alpha y) + D\cos(\alpha x)\cosh(\alpha y). \tag{5}$$

Testing this with one of the boundary conditions shows that this can't be right though. $$\phi(\frac{\pi}{2},y) \overset{!}{=} Ucos(y) \neq eq.(5)$$

I hope someone can help me find a good approach to problems like this in general, since I find non-constant boundary conditions very interesting.

To solve the differential equation I chose to split it into a set of separate equations, however I am not sure if this is a good idea.

It's a good idea if the boundary conditions are homogeneous (that point isn't fully clear yet)

However, there's a minor sign error in $$(2)$$, which as such cannot lead to $$(3)$$ and $$(4)$$. It should be, with Ansatz $$\phi(x,y)=X(x)Y(y)$$:

$$-\frac{X''(x)}{X(x)} = \frac{Y''(y)}{Y(y)} = -\alpha^2$$So the $$Y$$ ODE becomes: $$Y''+\alpha^2 Y=0$$ At this point we need to carry out a transformation of the variable $$y$$ to. This transformation is needed to render the first boundary condition homogeneous.

$$\hat{y}=y+\frac{\pi}{2}$$

Or $$\hat{y}$$ is '$$y$$ hat'. So the 'new' $$Y$$ ODE becomes:

$$Y(\hat{y})=A\sin \alpha \hat{y}+B\cos \alpha \hat{y}$$ 1st boundary condition: $$\phi(x,0)=0\Rightarrow X(x)Y(0)$$ $$\text{If }X(x)\neq 0 \Rightarrow Y(0)=0$$ $$0=A\sin 0+B\cos 0\Rightarrow B=0$$ 2nd boundary condition: $$\phi(x,\pi)=0\Rightarrow X(x)Y(\pi)$$ $$\text{If }X(x)\neq 0 \Rightarrow Y(\pi)=0$$ $$\Rightarrow 0=A\sin \pi \alpha$$ So that: $$n\pi =\pi \alpha$$ $$\alpha=n\text{ for }n=1,2,3,...$$ $$\Rightarrow Y(\hat{y})=A\sin(n\pi \hat{y})$$ The $$X$$ ODE is: $$X''-\alpha^2 X=0$$ Which has the general solution: $$X(x)=Ce^{\alpha x}+De^{-\alpha x}$$ With boundary conditions: $$\phi(\pm\frac{\pi}{2},y) = U\cos(y)$$ $$X(\pm\frac{\pi}{2})Y(y)=U\cos(y)$$

And TBH this is where I'm stumped. This is a strange and non-homogeneous boundary condition which seems neither use nor ornament.

• Thank you for finding the sign error. Fixed that. I also thought about doing some kind of transformation, but wasn't sure if I am allowed to do that.
– MLK
Jul 22 '20 at 21:22
• You're allowed to but you may have to 'back-substitute' at the end. But that's not a problem at all.
– Gert
Jul 22 '20 at 21:25
• So sticking with the transformation could I do something like $X(\pm\frac{\pi}{2})Y(\hat{y})=U\sin(y)$ (using $\cos(x+\frac{\pi}{2}=\sin(x)$) and choose the ansatz $X(x) = Ce^{iax}+De^{-iax}$ and choose $C, D$ and $a$ such that $X(\pm\frac{\pi}{2})=1$ or am I misusing the $\hat{y}$-transformation with that?
– MLK
Jul 22 '20 at 21:31
• You can use $\cos(\hat{y})=\cos(y+\pi/2)=\sin y$ but that doesn't solve anything. No, without homogeneous BCs for $X(x)$ the integration constants $C$ and $D$ cannot be determined. Also, you say you're 'interested' in non-constant BCs but trust me: they're a nightmare!
– Gert
Jul 22 '20 at 21:42
• No problem. Here's a little further reading on these PDEs: tutorial.math.lamar.edu/Classes/DE/HeatEqnNonZero.aspx
– Gert
Jul 22 '20 at 21:48