In their paper User's guide to viscosity solutions of second order differential partial equations, Crandall, Ishii and Lions define the superjet of an upper semicontinuous function $u$ at $\hat x \in \mathcal O$, $\mathcal O$ a locally compact subset of $\mathbb R^N$, to be the set of $(p, X) \in \mathbb R^N \times \mathcal S_N$ ($\mathcal S_N$ the set of symmetric matrices) such that \begin{equation} u(x) \leq u(\hat x) + \langle p, x - \hat x \rangle + \frac 12 \langle X(x - \hat x), x - \hat x \rangle + o(|x - \hat x|^2) \quad \quad (*) \end{equation} holds. The superjet is denoted $J_{\mathcal O}^{2, +}u(\hat x)$. It is left as an exercise that $$ J_{\mathcal O}^{2, +}u(\hat x) = \{(D\varphi(\hat x), D^2 \varphi(\hat x)) \ : \ \varphi \in C^2 \text{ and } u - \varphi \text{ has a local maximum at } \hat x\}. $$
My question is: given $(p, X) \in \mathbb R^N \times \mathcal S_N$ such that $(*)$ holds, how to find such a $\varphi$?
Thanks in advance.
This is proved in Proposition 12.11 in the Calder's Viscosity Solutions notes: http://www-users.math.umn.edu/~jwcalder/viscosity_solutions.pdf
The proof is similar to the one given by your professor, copied in another answer. If there is some step in the proof that is not clear, I can elaborate on it in this answer to explain it more clearly.
EDIT: My guess is your confusion is near the end of the proof, where one verifies that the constructed test function has the correct derivatives. I'll add some details here, and I'll follow the proof in Calder's \ notes above.
At the end of the proof we've shown that $$u(x) \leq p \cdot x + \frac{1}{2}x^T X x + \sigma(3|x|)=:\varphi(x)$$ in a neighborhood of the origin (we've taken $\hat{x}=0$). Earlier in the proof we defined $$\sigma(r) = \int_0^r \int_0^s \rho(t)\, dt\, ds,$$ where $\rho$ is continuous, nondecreasing, and $\rho(0)=0$. From this, we immediately have $$(*) \ \ \ \sigma(r) \leq \frac{1}{2}r^2\rho(r),$$ $$(**) \ \ \ \sigma'(r) = \int_0^r \rho(t) \, dt \leq r\rho(r),$$ and $$(***) \ \ \ \sigma''(r) \leq \rho(r).$$ In particular, $\sigma$ is $C^2$ on $[0,\infty)$ and $$\sigma(0)=\sigma'(0)=\sigma''(0)=0.$$
I assume what is not clear is to show that $D \varphi(0)= p$ and $D^2\varphi(0)=X$, as is claimed (without details) in the notes. To prove this, we just need to consider the perturbative term $$\psi(x) := \sigma(3|x|),$$ and show that its gradient and Hessian vanish at $x=0$. By $(*)$ we have $$|\psi(x)| \leq \frac{9}{2}\rho(3|x|)|x|^2.$$ It follows by writing the difference quotient definition of the derivative that $D\psi(0)=0$. We also compute $$D\psi(x) = 3\sigma'(3|x|)\frac{x}{|x|} \ \ \text{for }x\neq 0.$$ By $(**)$ we see that $D\psi(x)$ is continuous at $x=0$. Similarly, by $(**)$ we see that $$|D\psi(x)| \leq 9\rho(3|x|)|x|.$$ Again using the difference quotient definitions of the derivative we have $D^2\psi(0)=0$, since $\rho$ is continuous and vanishes at the origin. We also compute $$D^2\psi(x) = 3\sigma'(3|x|)\frac{I}{|x|} + 3\left(3\sigma''(3|x|) - \frac{\sigma'(3|x|)}{|x|}\right) \frac{xx^T}{|x|^2}$$ for $x\neq 0$. As before, by $(**)$ and $(***)$ we find that $D^2\psi(x)\to 0$ as $x\to 0$, so we have continuity at zero. This verifies that $\psi$ is indeed $C^2$ and has vanishing gradient and Hessian.
I hope this helps clear things up. Let me know if you have other questions.