i'll add comments. for reference, see a section "Shape Functions for Triangular Elements " in  http://kratos-wiki.cimne.upc.edu/index.php/Two-dimensional_Shape_Functions