I am trying to understand how to get the discrete gradient of a mesh that is being used as the input of some function $f$. In other words for every vertex $v$ there is a scalar quantity $s$ associated with it.
I am trying to understand how to compute the discrete gradient of $f$ on the surface. For that purpose I was checking these slides:
http://www.hao-li.com/cs599-ss2015/slides/Lecture04.1.pdf
But it's not clicking. The piece wise notation I am assuming is just an attempt at formalizing "we have no idea what the values at the triangles would be, so we are just going to linearly interpolate using Barycentric coordinates".
But then the slides reach this final formula for the gradient:

I kinda understand the bottom part, which seems to say the gradient basis at $i$ is a vector orthogonal to the opposite edge divided by 2 times the area of the triangle (I assume), but how was the top formula derived?