Evaluating an integral and differentiation I'm trying to understand the math in a journal paper, but I'm stuck on figuring out one of the integrals. 
Here is the paper called, "Simultaneous optimization of the material properties and the topology of functionally graded structures"
http://www.sciencedirect.com/science/article/pii/S0010448508000249
Here is the problem equation part
$$
\alpha*\int_{\Omega} \left|\nabla w(x)\right|^2dx \tag 1
$$
where the omega and dx indicate an area integral over a domain. Then the equation is differentiated with respect to omega
Then the authors say they integrate by parts to get
$$
-\int_{\Omega} \alpha \Delta\omega dx + \int_{\Gamma}\nabla\omega(x)*nds \tag 2 
$$
I'm not sure how they got the equation. When I differentiate the first equation, I get this, but I'm not sure how integration by parts makes it simplier. It looks like they used the divergence theorem in there somewhere, but I'm not sure. 
$$
2*\nabla(w)*\frac{d\nabla(w)} {dw} \tag 3
$$
Thanks for the help. It is equation 15 and 17 in the paper, if that helps. 
Anthony
 A: Using the product rule for the divergence, we have the identity 
$$\nabla \cdot (w\nabla w)=\nabla w\cdot \nabla w+w\nabla ^2w$$
where the Laplacian operator is $\nabla ^2\left(\cdot\right)=\nabla \cdot \nabla\left(\cdot\right)$ Then,
$$\begin{align}
\alpha \int_{\Omega}\left|\nabla w\right|^2dx&=\alpha \int_{\Omega}\nabla w\cdot \nabla w\,dx \tag 1\\\\
&=\alpha \int_{\Omega}\left(\nabla \cdot (w\nabla w)-w\nabla ^2w\right)dx
\end{align}$$
Invoking the Divergence Theorem reveals
$$\begin{align}
\alpha \int_{\Omega}\left|\nabla w\right|^2dx&=\alpha \int_{\Gamma}w(\hat n\cdot \nabla w)dS-\int_{\Omega}\alpha \,w\,\nabla ^2w\,dx
\end{align}$$
and we're done.

Now, suppose we wish to find the variation of the left-hand side of $(1)$.  We have
$$\begin{align}
\delta I(w,v)& \equiv\lim_{\epsilon \to 0} \left(\frac{\alpha}{\epsilon}\,\int_{\Omega}\left(\left|\nabla (w+\epsilon v)\right|^2-\left|\nabla w\right|^2\right)dx\right)\\\\
&=\lim_{\epsilon \to 0}\left(\frac{\alpha}{\epsilon} \int_{\Omega}\left( 2\epsilon\nabla w\cdot \nabla v+\epsilon^2\nabla v\cdot \nabla v\right)\,dx\right)\\\\
&=2\alpha\int_{\Omega}\nabla w\cdot \nabla v\,dx\\\\
&=2\alpha\left(\oint_{\Gamma}v\left(\hat n \cdot \nabla w\right)\,dS-\int_{\Omega}v\nabla^2w\,dx\right)
\end{align}$$
