  We prove that the viscosity solution to a Hamilton-Jacobi equation with a
smooth convex Hamiltonian of the form $H(x,p)$ is differentiable with respect
to the initial condition. Moreover, the directional G\^ateaux derivatives can
be explicitly computed almost everywhere in $\mathbb{R}^N$ by means of the
optimality system of the associated optimal control problem. We also prove
that, in the one-dimensional case in space and in the quadratic case in any
space dimension, these directional G\^ateaux derivatives actually correspond to
the unique duality solution to the linear transport equation with discontinuous
coefficient, resulting from the linearization of the Hamilton-Jacobi equation.
The motivation behind these differentiability results arises from the following
optimal inverse-design problem: given a time horizon $T>0$ and a target
function $u_T$, construct an initial condition such that the corresponding
viscosity solution at time $T$ minimizes the $L^2$-distance to $u_T$. Our
differentiability results allow us to derive a necessary first-order optimality
condition for this optimization problem, and the implementation of
gradient-based methods to numerically approximate the optimal inverse design.
