# Laplace's equation to solve a system in a square

Solve the system in the square $S = \{0 < x < 1, 0 < y < 1\}$: $$\begin{cases} \Delta u = 0 \ \ \ &\text{for} \ \ (x,y)\in S\\ u(x,0) = 0, \ u(x,1) = x \ \ \ &\text{for} \ \ 0 < x < 1\\ u_x(0,y) = 0, \ u_x(1,y) = y^2 \ \ \ &\text{for} \ \ 0 < y < 1 \end{cases}$$

Attempted solution - We know that the general solution is $$u(x,y) = \sum_{n=0}^{\infty}A_n \sin \beta_n x(\beta_n \cosh \beta_n y - \sinh \beta_n y)$$ Applying the initial condition $$u(x,1) = x = \sum_{n=0}^{\infty}A_n \sin \beta_n x(\beta_n \cosh \beta_n - \sinh \beta_n)$$ Then I think $$A_n = \frac{2}{\beta_n\cosh \beta_n - \sinh\beta_n}\int_{0}^{1} x\sin \beta_n x dx = \frac{2\sin(\beta_n) - 2\beta_n \cos(\beta_n)}{\beta_n^{3}\cosh \beta_n - \beta_n^{2}\sinh \beta_n}$$ But I am really not understanding how to solve this problem. Please provide steps on how to solve this. Assuming I get $A_n$ then how do I apply the condition that $u_x(1,y) = y^2$? It seems to me that we would have $$u_x(x,y) = \sum_{n=1}^{\infty}A_n \beta_n \cos \beta_n x(\beta_n \cosh \beta_n y - \sinh \beta_n y)$$ Then $$u_x(1,y) = y^2 = \sum_{n=0}^{\infty} A_n \beta_n \cos \beta_n(\beta_n \cosh \beta_n y - \sinh \beta_n y)$$

Given that $\Delta u = 0$ this implies that $\nabla^2 u = 0$ or $$\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial^2 y} = 0$$ Let $u = X(x)Y(y)$ then $$Y \frac{d^2 X}{d^2 x^2} + X \frac{d^2 Y}{d^2 y} = 0$$ Now we have two cases for boundary conditions $$\text{Case 1:} \ u_1(x,0) = 0, \ \ u_1(x,1) = 0, \ \ u_{1x}(0,y) = 0, \ \ u_{1x}(1,y) = y^2$$ $$\text{Case 2:} \ u_2(x,0) = 0, \ \ u_2(x,1) = x, \ \ u_{2x}(0,y) = 0, \ \ u_{2x}(1,y) = 0$$ Now using equation $(2)$ with case $1$ we have $$\frac{1}{Y}\frac{d^2 Y}{d^2 y} = -\frac{1}{X}\frac{d^2 X}{d^2 x^2} = -p^2 \ \ (\text{say})$$ Then solving for this we have $$Y = c_1 \cos(p y) + c_2 \sin(py) \ \ \text{and} \ \ X = c_3 e^{px} + c_4 e^{-p x}$$ Hence $$u = XY = (c_1 \cos(py) + c_2 \sin(py))(c_3 e^{px} + c_4 e^{-px})$$ Now apply case $1$ we get $$c_1 = 0, \ \ 0 = (c_3 e^{px} + c_4 e^{-px})(c_2 \sin(p))$$ Then $$\sin(p) = 0 = \sin(n\pi) \Rightarrow p = n\pi$$ Also $u_{1x}(0,y) = 0$ then $$0 = (c_3(n\pi) - c_4(n\pi))(c_2 \sin(n\pi y)) \Rightarrow (c_3 - c_4)c_2\sin(n\pi y) = 0$$ Now $u_{1x}(1,y) = y^2$ then \begin{align*} y^2 &= (n\pi c_3 e^{n\pi} - n\pi c_4 e^{-n\pi} )(c_2 \sin(n\pi y))\\ &\Rightarrow y^2 = \sum_{n=1}^{\infty}(A_n e^{n\pi} - B_n e^{-n\pi})\sin(n \pi y) \end{align*} where $$A_n = \frac{2}{e^{n\pi}}\int_{0}^{1}y^2 \sin(n\pi y) dy = \ldots = \frac{2e^{\pi(-n)}((2 - \pi^2 n^2)\cos(\pi n) + 2\pi n(\sin(\pi n) - 2 ) }{\pi^3 n^3}$$ and $$B_n = -\frac{2}{e^{-n\pi}}\int_{0}^{1}y^2 \sin(n\pi y)dy = \ldots = -\frac{2e^{\pi n}((2 - \pi^2 n^2)\cos(\pi n) + 2\pi n(\sin(\pi n) - 2 ) }{\pi^3 n^3}$$ Hence the solution is $$u = \sum_{n=1}^{\infty}(A_n e^{n\pi} - B_n e^{-n \pi})\sin(n\pi y)$$ Similarly for case $2$, we can find the solution to $$\frac{1}{Y}\frac{d^2 Y}{d^2 y} = -\frac{1}{X}\frac{d^2 X}{d^2 x^2} = -p^2$$ $$\Rightarrow u = (c_1 \cos(py) + c_2 \sin(py))(c_3 e^{px} + c_4 e^{-px})$$ using case $2$, we get $$u_2(x,0) = 0 \Rightarrow c_3 + c_4 = 0 \Rightarrow c_3 = -c_4$$ So $$u = (c_1 \cos(py) + c_2 \sin(py))(c_3 e^{px} + c_4 e^{-px})$$ applying $u_{2x}(0,y) = 0$ then \begin{align*} 0 &= c_3(e^{py} - e^{-py})p c_2 \cos(p)\\ \Rightarrow c_2 &= 0 \end{align*} So we have $$u = c_1 c_3 \cos(px)(e^{py} - e^{-py})$$ Now, applying $u_{2x}(1,y) = 0$ then $$\sin(p) = 0 = \sin(n\pi) \Rightarrow p = n\pi$$ So $$u = c_1 c_3 \cos(n\pi x)(e^{n\pi y} - e^{-n\pi y})$$ We have the general solution $$u = \sum_{n=1}^{\infty}A_n \cos(n\pi x)(e^{n\pi y} - e^{-n\pi y})$$ Applying $u_2(x,1) = x$ we have $$x = \sum_{n=1}^{\infty}A_n \cos(n\pi x)(e^{n \pi} - e^{-n\pi})$$ where $$A_n = \frac{2}{e^{n\pi} - e^{-n\pi}}\int_{0}^{1} x \cos(n\pi x) dx = \ldots = \frac{2(\pi n \sin(\pi n) + \cos(\pi n) - 1 )}{\pi^2 (e^{\pi n} - e^{\pi(-n)})n^2 }$$