The goal of these lecture notes is to provide an informal introduction to the use of variational techniques for solving constrained optimization problems with equality constraints and full state information. The use of the Lagrangian augmented cost function and variational techniques by which the adjoint equation and the optimality condition are found are introduced by the use of examples starting from steady finite-dimensional problems to end with unsteady initial-boundary value problems. Gradient methods based on sensitivity and adjoint equation solutions are also mentioned.