The adjoint method is a very efficient way to compute the gradient of a cost functional associated to a dynamical system depending on a set of input signals. However, the numerical solution of the adjoint differential equations raises several questions with respect to stability and accuracy. An alternative and maybe more natural approach is the discrete adjoint method (DAM), which constructs a finite difference scheme for the adjoint system directly from the numerical solution procedure, which is used for the solution of the equations of motion. The method delivers the exact gradient of the discretized cost functional subjected to the discretized equations of motion. For the application of the discrete adjoint method to the forward solver, several matrices are necessary. In this contribution, the matrices are derived for the simple Euler explicit method and for the classical implicit Hilber–Hughes–Taylor (HHT) solver.