Rayleigh-Ritz approximation, showing the energy is minimized in the linear system 
Consider the Dirichlet problem
  $$\begin{cases}
\Delta u = g \ \ &\text{in} \ U,\\
u = g \ \ &\text{on} \ \partial U
\end{cases}$$
  The energy for this problem (which the solution minimizes) is
  $$E[w] = \int_{U} \frac{1}{2}|Dw|^2 dx$$
  for $w\in\mathcal{A} = \{w\in C^{2}(\bar{U})| w = g \ \text{on} \ \partial U \}$. Suppose that we fix a $w_0\in\mathcal{A}$; and we also fix $w_1,w_2,\ldots,w_n\in C^{2}(\bar{U})$ which have values $0$ on the boundary. We seek to approximate the solution $u$ by considering functions of the form
  $$\tilde{u} = w_0 + \sum_{k=1}^{n}c_k w_k$$
  for constants $c_1,\ldots,c_n$. That is, we consider only part of $\mathcal{A}$:
  $$\tilde{\mathcal{A}} = \{ w_0 + \sum_{k=1}^{n}c_k w_k| c_1,\ldots,c_n\mathbb{R} \}$$
  Note that $\tilde{\mathcal{A}}$ is a finite-dimensional submanifold of $\mathcal{A}$.\
  \noindent
  Show that the energy is minimized in $\tilde{\mathcal{A}}$ exactly when the constants $c_k$ satisfy the linear system 
  $$\sum_{k=1}^{n}c_k \int_{U} D w_j \cdot D w_k dx = -\int_{U} D w_0\cdot Dw_j dx \ \ \ \text{for} \ j=1,\ldots,n$$

Attempted proof - Let $w = \tilde{u} = w_0 + \sum_{k=1}^{n}c_k w_k$. Then we have 
\begin{align*}
E[w] &= \frac{1}{2}\int_{U}|Dw|^2 dx\\ &= \frac{1}{2}\int_{U}Dw\cdot Dw dx\\ &= \frac{1}{2}(Dw,Dw)\\
&= \frac{1}{2}\left(Dw_0 + \sum_{k=1}^{n}c_k D w_k, Dw_0 + \sum_{k=1}^{n}c_k D w_k  \right)\\
&= \frac{1}{2}\left[ (Dw_0,Dw_0) + \left(Dw_0, \sum_{k=1}^{n}c_k D w_k \right) +  \left(\sum_{k=1}^{n}c_k Dw_k,Dw_0 \right) + \left(\sum_{k=1}^{n}c_k Dw_k,\sum_{k=1}^{n}c_k Dw_k \right)  \right]\\
&= \frac{1}{2}\left[(Dw_0,Dw_0) + 2\left(Dw_0,\sum_{k=1}^{n}c_k Dw_k \right) + \left(\sum_{k=1}^{n}c_k Dw_k,Dw_0 \right) + \left(\sum_{k=1}^{n}c_k Dw_k,\sum_{k=1}^{n}c_k Dw_k \right)  \right]\\
&= \frac{1}{2}\left[(Dw_0,Dw_0) + 2\sum_{k=1}^{n} \left(Dw_0, Dw_k \right)c_k + \sum_{k=1}^{n}(D w_k, D w_k)c_k^{2} + 2\sum_{j=1}^{n}\sum_{k\neq j}^{n}(Dw_k, Dw_k)c_k c_j  \right]\\
&= \frac{1}{2}(Dw_0,Dw_0) + \sum_{k=1}^{n}(Dw_0,Dw_k)c_k + \frac{1}{2}\sum_{k=1}^{n}(D w_k, D w_k)c_k^{2} + \sum_{j=1}^{n}\sum_{k\neq j}^{n}(Dw_k, Dw_k)c_k c_j
\end{align*}
for the choice of coefficients $c_j$ for $j = 1,\ldots,n$ which minimizes $E$, the partial derivative of $E$ with respect to each $c_j$ must vanish. In other words, for $j = 1,\ldots ,n$ it follows that 
$$\frac{\partial}{\partial c_k}E[w] = 0$$
I am not sure how to go on after this where we will have that the energy is minimized in $\tilde{A}$ exactly when the constants $c_k$ satisfy the linear system 
$$\sum_{k=1}^{n}c_k \int_{U} D w_j \cdot D w_k dx = -\int_{U} D w_0\cdot Dw_j dx \ \ \ \text{for} \ j=1,\ldots,n$$
Any suggestions on where to go from here are greatly appreciated.
 A: 
Consider the Dirichlet problem
  $$\begin{cases}
\Delta u = 0 \ \ &\text{in} \ U,\\
u = g \ \ &\text{on} \ \partial U
\end{cases}$$
  The energy for this problem (which the solution minimizes) is
  $$E[w] = \int_{U} \frac{1}{2}|Dw|^2 dx$$
  for $w\in\mathcal{A} = \{w\in C^{2}(\bar{U})| w = g \ \text{on} \ \partial U \}$. Suppose that we fix a $w_0\in\mathcal{A}$; and we also fix $w_1,w_2,\ldots,w_n\in C^{2}(\bar{U})$ which have values $0$ on the boundary. We seek to approximate the solution $u$ by considering functions of the form
  $$\tilde{u} = w_0 + \sum_{k=1}^{n}c_k w_k$$
  for constants $c_1,\ldots,c_n$. That is, we consider only part of $\mathcal{A}$:
  $$\tilde{\mathcal{A}} = \{ w_0 + \sum_{k=1}^{n}c_k w_k| c_1,\ldots,c_n\mathbb{R} \}$$
  Note that $\tilde{\mathcal{A}}$ is a finite-dimensional submanifold of $\mathcal{A}$. 
Show that the energy is minimized in $\tilde{\mathcal{A}}$ exactly when the constants $c_k$ satisfy the linear system 
  $$\sum_{k=1}^{n}c_k \int_{U} D w_j \cdot D w_k dx = -\int_{U} D w_0\cdot Dw_j dx \ \ \ \text{for} \ j=1,\ldots,n$$

Your attempted proof is in the good path. Here it is fully developed.
Proof: 
Recall that the inner product in $L^2(U, \mathbb{R}^n)$ is 
$$<f,g> =\int_{U} f.g \: dx = <g,f>$$
Let $ v = w_0 + \sum_{k=1}^{n}c_k w_k$. We have 
\begin{align*}
E[v] & = \int_{U}\int_{U} \frac{1}{2}|Dv|^2 dx = \int_{U}\int_{U} \frac{1}{2}Dv.Dv \: dx = \frac{1}{2} <Dv,Dv>= \\
&=  \frac{1}{2} \left <Dw_0 + \sum_{k=1}^{n}c_k Dw_k,\: Dw_0 + \sum_{k=1}^{n}c_k Dw_k \right >= \\
&= \frac{1}{2} <Dw_0, Dw_0> + \sum_{k=1}^{n} <Dw_0,Dw_k> c_k +  \frac{1}{2}\sum_{k=1}^{n} <Dw_k,Dw_k> c_k^2 + \\ & \phantom{\frac{1}{2} <Dw_0, Dw_0> +} +\frac{1}{2} \sum_{k=1}^{n} \sum_{j\ne k}^{n}<Dw_k,Dw_j> c_k c_j
\end{align*}
So, considering any fixed $i$ in $\{1, \dots n\}$, we have 
\begin{align*}
\frac{\partial}{\partial c_i} E[v] 
&=  <Dw_0,Dw_i>  +  <Dw_i,Dw_i> c_i + \frac{1}{2} \sum_{j\ne i}^{n}<Dw_i,Dw_j> c_j + \\ & \phantom{<Dw_0,Dw_i> +} + \frac{1}{2} \sum_{j\ne i}^{n}<Dw_j,Dw_i> c_j = \\
&=  <Dw_0,Dw_i>  +  <Dw_i,Dw_i> c_i +  \sum_{j\ne i}^{n}<Dw_i,Dw_j> c_j  = \\ 
&=  <Dw_0,Dw_i>  +   \sum_{j=1}^{n}<Dw_i,Dw_j> c_j
\end{align*}
If the coefficients $c_1, \dots c_n$ minimize $E$, then we must have, for all $i\in \{1, \dots n\}$, 
$$ 0= \frac{\partial}{\partial c_i} E[v] = <Dw_0,Dw_i>  +   \sum_{j=1}^{n}<Dw_i,Dw_j> c_j$$
That means,  for all $i\in \{1, \dots n\}$ 
$$  \sum_{j=1}^{n}<Dw_i,Dw_j> c_j = -<Dw_0,Dw_i> $$
which means,   for all $i\in \{1, \dots n\}$ 
$$  \sum_{j=1}^{n}\int_{U}c_j Dw_i.Dw_j \: dx = - \int_{U} Dw_0.Dw_i \: dx$$
Just rename de index and we have, for all $j\in \{1, \dots n\}$, 
$$  \sum_{k=1}^{n}\int_{U}c_k Dw_j.Dw_k \: dx = - \int_{U} Dw_0.Dw_j \: dx$$
Remark 1: To compute $\frac{\partial}{\partial c_i} $ of 
$$\frac{1}{2} \sum_{k=1}^{n} \sum_{j\ne k}^{n}<Dw_k,Dw_j> c_k c_j$$ 
note that, if $k\neq i$ or $\neq i$, then 
$$ \frac{\partial}{\partial c_i} <Dw_k,Dw_j> c_k c_j=0$$
So the only terms with a possible non-zero derivative are those where either $k=i$ or $j=i$ ( and since $j \neq k$, if $j=i$ then $k \neq i$). So, we have 
\begin{align*}
\frac{\partial}{\partial c_i} & \left ( \frac{1}{2} \sum_{k=1}^{n} \sum_{j\ne k}^{n}<Dw_k,Dw_j> c_k c_j\right) = \\ &= 
 \frac{1}{2} \sum_{j\ne i}^{n}<Dw_i,Dw_j> c_j + \frac{1}{2} \sum_{k\ne i}^{n}<Dw_k,Dw_i> c_k = \\
&= \frac{1}{2} \sum_{j\ne i}^{n}<Dw_i,Dw_j> c_j + \frac{1}{2} \sum_{j\ne i}^{n}<Dw_j,Dw_i> c_j = \\
& =  \sum_{j\ne i}^{n}<Dw_i,Dw_j> c_j 
\end{align*}
Remark 2: To prove that 
$$ <Dw_i,Dw_i> c_i +  \sum_{j\ne i}^{n}<Dw_i,Dw_j> c_j  =  \sum_{j=1}^{n}<Dw_i,Dw_j> c_j $$
just note that 
$$\left ( \sum_{j=1}^{n}<Dw_i,Dw_j> c_j \right )- \left (\sum_{j\ne i}^{n}<Dw_i,Dw_j> c_j \right ) = <Dw_i,Dw_i> c_i $$
