This is a segment of the proof to "Hopf's Lemma," from page 348 of PDE Evans, 2nd edition. I have a question regarding this, at the bottom of this post.
Proof. 1. Assume $c \ge 0$. We may as well further assume $B = B^0(0,r)$ for some radius $r > 0$. Define $$v(x) := e^{-\lambda |x|^2} - e^{-\lambda r^2} \qquad (x \in B(0,r))$$ for $\lambda > 0$ as selected below. Then using the uniform ellipticity condition, we compute \begin{align} Lv &= -\sum_{i,j=1}^n a^{ij} v_{x_i x_j} + \sum_{i=1}^n b^i v_{x_i} + cv \\ &= e^{-\lambda |x|^2} \sum_{i,j=1}^n a^{ij}(-4\lambda^2 x_i x_j + 2\lambda \delta_{ij}) - e^{-\lambda |x|^2} \sum_{i=1}^n b^i2\lambda x_i + c(e^{-\lambda|x|^2}-e^{-\lambda r^2}) \\ &\le e^{-\lambda |x|^2}(-4 \theta \lambda^2 |x|^2 + w \lambda \operatorname{tr}\textbf{A} + 2\lambda |\textbf{b}||x|+c), \end{align} for $\textbf{A}=((a^{ij})), \textbf{b}=(b^1,\ldots,b^n)$.
The proof does not stop here in the book, but my question concerns only this part of the proof.
Where did the $2\lambda \delta_{ij}$ term come from? I differentitated $v$ twice to get $$v_{x_i x_j}=4\lambda^2 x_i x_j e^{-\lambda |x|^2}.$$ I didn't think I was required to use the product rule for finding the second derivative here.
My second question concerns the trace of a matrix, in this case the trace of matrix $\textbf{A}$, or $\operatorname{tr}\textbf{A}$. I know so far that if $\textbf{A}$, has $n \times n$ dimensions, then the trace of the matrix is defined as the summation of diagonal entries of it, that is, $$\operatorname{tr} \textbf{A}=a^{11}+a^{22}+\cdots+a^{nn}=\sum_{i=1}^n a^{ii}.$$ (Yes, I know, I typed the indices as superscripts instead of subscripts to stay consistent with Evans' crazy textbook notation.) Anyway, if I may ask, how does this help in obtaining the very last inequality in obtaining the estimate to $Lv$? Because $\operatorname{tr}\textbf{A}$ was used somehow in the last line but I'm not seeing it clearly yet. (I do know how the ellipticity condition was used however; no need to worry about that part.)
1. $\partial_iv(x)=-2\lambda x_ie^{-\lambda|x^2|}$, so by the product rule $\partial_j\partial_iv(x)=-2\lambda(x_i\partial_je^{-\lambda|x^2|}+e^{-\lambda|x^2|}\partial_jx_i)$. The result follows from $\partial_jx_i=\delta_{ij}$. You just seem to have forgotten to differentiate $x_i$ when calculating the second derivative.
2. I believe what you are missing is this: $\operatorname {tr} \textbf{A}=\sum_{i,j}\delta_{ij}a^{ij}$. I strongly encourage you to verify this identity yourself, as it is a straightforward calculation and something you might want to learn to understand at glance.