# How do you project the Hessian along a certain vector?

I have been trying to understand the Gaussian optimiser (Berny optimiser algorithm) from what has been written in their manual. So far, I have understood most of it, but one part has been giving me trouble as there is no mathematical equation there.

Copied from the manual:

If a minimum is sought, perform a linear search between the latest point and the best previous point (the previous point having lowest energy). If second derivatives are available at both points and a minimum is sought, a quintic polynomial fit is attempted first; if it does not have a minimum in the acceptable range (see below) or if second derivatives are not available, a constrained quartic fit is attempted. This fits a quartic polynomial to the energy and first derivative (along the connecting line) at the two points with the constraint that ...

I understand that linear search is essentially doing a search in 1-dimension. If the 1D search is between two points, then I could project the gradient along the vector between the two points. The gradient is a N-dimensional vector, and the search dimension is also an N-dimensional vector (N is the total number of coordinates). So projection would be a straightforward dot product between the two vectors (taking the search direction as unit vector). This would give me the first derivative (gradient) along the search direction ($$\hat{r}$$).

$$g_\mathrm{1D} = \vec{g}\cdot\hat{r}$$

But before that they mention that they use second derivatives (Hessian) if available. But Hessian is a (N $$\times$$ N) matrix, but for a 1D search, I need only the second derivative (which is only a scalar number) along the search direction. I can't think of a way to get a scalar number from a matrix and a vector. How do you get the second derivative along a vector direction from a full Hessian matrix?

I have a vague understanding that Hessian would be a tensor (?), which would have to be treated differently than vectors but I do not have enough mathematical background to understand how to get the 1D second derivative from the full Hessian matrix (This question is kind of unrelated to Gaussian, because I am asking a general mathematical question). Also the Gaussian manual does not give any reference for that part so I didn't have a paper that I could read.

• Related Math SE question/answer: math.stackexchange.com/questions/2573376/…
– Tyberius
Feb 23, 2023 at 2:18
• Wow! @Tyberius did you know that Math.SE thread from before, or you just found it? Feb 23, 2023 at 2:58
• @NikeDattani Just went searching for it after seeing the question. I had a feeling that part of the problem for OP finding references was just missing terminology. The projection OP describes for a gradient along a direction is more commonly referred to as the directional derivative. Searching "second directional derivative" in Google led me directly there.
– Tyberius
Feb 23, 2023 at 14:15
• @Tyberius Thank you! This solves my problem I believe. If you convert it to answer, I will be happy to accept it. Feb 25, 2023 at 11:42