Dear all, I am investigating a Transient Optimal Heating Problem with distributed control and Dirichlet condition. The following are the mathematical expression of the problem: Where Ω is the domain, Γ is the boundary, y is the temperature distribution, u is the control, yΩ is the optimal temperature distribution, yD is some known temperature on Γ (i.e. Dirichlet condition), λ and κ are some real constant. I want to find the adjoint equation for the above problem, I found on some articles that I need to use Lagrangian Function and Divergence Theorem with Integration by Parts to derive the adjoint equation. In other words, consider d/dε [L(y+εz,u,λ)] =0 and put ε=0, where L(y,u,λ) is the Lagrangian Function. However, I could not keep going and derive the adjoint equation. I do not know how to apply Divergence Theorem with Integration by Parts to get the adjoint equation. Can anyone help me to derive the adjoint equation?