# Deriving the residual error for finite elements.

I am using the following set of notes for adaptive finite elements (https://www.ruhr-uni-bochum.de/num1/files/lectures/AdaptiveFEM.pdf) and am trying to go through the error calculations on page 29&30.

So far I have the following: We define our residuals as, $$R_k(U_T)=f+\Delta u_T$$ and $$R_E(u_T)=\begin{cases} -\mathbb{J}(\underline{n}_E\cdot\nabla u_T) \ \text{if} \ E\in\epsilon_\omega \\ g-\underline{n}_E\nabla u_T \ \ \text{if} E\in\epsilon_{\Gamma_N}\\ 0 \ \text{otherwise} \end{cases}$$

where K is the triangle and E are the edges, \Gamma_N is the Neumann BCs. Then by considering the poisson equation, $$\Delta u_T=-f$$ and the variational form, $$\int \nabla u_T \nabla v=\int fv+\int_{\partial \omega} gv \ \text{for all} \ v\in H^1(\omega)$$.

Then we have

$$-\int \nabla u_T \nabla v+\int fv+\int_{\partial \omega} gv=\sum_K-\int_K \nabla u_T \nabla v+\int_K fv+\sum_E \int_{E} gv$$.

Then after applying integration by parts and using the inequalities associated with quasi-interpolation we find the following,

$$\leq \sum_K||R_K(u_T)||_K c_{A1}h_K||w||_{H^1(\tilde{w}_K})+\sum_E||R_E(u_T)||_Ec_{A2}h_E^{\frac{1}{2}}||w||_{H^1(\tilde{w}_E}) \ \ \ \ \ \ \ \ \ (*)$$.

The next step by the author states the use of Cauchy_Schwarz inequality for sums to get, which is where I become stuck, $$\leq \text{max}(c_{A2},c_{A1})\left[\sum_Kh^2_K||R_K(u_T)^2_K+\sum_Eh_E||R_E(u_T)||^2_E \right] ^{\frac{1}{2}}\cdot\left[\sum_K||w||_{H^1(\tilde{w}_K)}^2+\sum_E||w||_{H^1(\tilde{w}_E)}^2\right]^{\frac{1}{2}} \ \ \ \ \ \ \ \ \ (+)$$, noting that the C-S inequality is,

$$(\sum_k(a_Kb_K))^2\leq(\sum_k a^2_k)(\sum_k b_k^2)$$

I am unsure how we get from $$(*)$$ to (+). If someone could offer some advice, I would appreciate it.

To make things simple. Let us denote, $$u_1=\|R_K(u_T)\|_Kh_K,\\\ u_2=\|R_E(u_T)\|_Eh_E^{1/2},\\\ v_1=\|w\|_{H^1(\bar{\omega}_K)},\ \mbox{and}\ v_2=\|w\|_{H^1(\bar{\omega}_E)}.$$
So, our equations reduce to $$\sum_Kc_{A1}u_1v_1+\sum_Ec_{A2}u_2v_2.$$
Now, using C-S inequality we have \begin{aligned} \sum_Kc_{A1}u_1v_1+\sum_Ec_{A2}u_2v_2 &\leq \mbox{max}\{c_{A1},c_{A2}\}\left[\left( \sum_Ku_1^2\right)^{1/2}\left( \sum_Kv_1^2\right)^{1/2} \\\ +\left( \sum_Eu_2^2\right)^{1/2}\left( \sum_Ev_2^2\right)^{1/2}\right] \end{aligned} Now, again for simplicity let us denote $$a_1=\left( \sum_Ku_1^2\right)^{1/2},\ a_2=\left( \sum_Eu_2^2\right)^{1/2}$$ and $$b_1=\left( \sum_Kv_1^2\right)^{1/2},\ b_2=\left( \sum_Ev_2^2\right)^{1/2}$$. Therefore, again by C-S inequality we get, \begin{aligned} \sum_Kc_{A1}u_1v_1+\sum_Ec_{A2}u_2v_2 &\leq \mbox{max}\{c_{A1},c_{A2}\}\left[a_1b_1+a_2b_2\right] \\&=\mbox{max}\{c_{A1},c_{A2}\}\sum_{i=1}^2a_ib_i \\&\leq \mbox{max}\{c_{A1},c_{A2}\}\left(\sum_{i=1}^2a_i^2\right)^{1/2}\left(\sum_{i=1}^2b_i^2\right)^{1/2} \end{aligned} Now, by reverse substituting we get \begin{aligned} \sum_Kc_{A1}u_1v_1+\sum_Ec_{A2}u_2v_2 &\leq \mbox{max}\{c_{A1},c_{A2}\}\left(\sum_Ku_1^2+\sum_Eu_2^2 \right)^{1/2}\left(\sum_Kv_1^2+\sum_Ev_2^2\right)^{1/2} \\&=\mbox{max}\{c_{A1},c_{A2}\}\left(\sum_K(\|R_K(u_T)\|_Kh_K)^2+\sum_E(\|R_E(u_T)\|_E^2h_E) \right)^{1/2} \\&\ \left(\sum_K(\|w\|_{H^1(\bar{\omega}_K)})^2+\sum_E(\|w\|_{H^1(\bar{\omega}_E)})^2\right)^{1/2} \end{aligned}