Local matrices - unstructured mesh I'm facing an "assembly issue" concerning a finite element method, that is a DG method, I was working on. I'll sum up my problem.
If we consider a $\mathbb{P}^1$ Lagrangian piece-wise discretization $\mathcal{T}_h$ (with finite element denoted $T_i$) of a domain $\Omega \subset \mathbb{R}^2$. Let $span\{\Phi_{i,j}, 1 \leq j \leq 3\}$ be the space of shape functions, $3$ is the number of degrees of freedom over $T_i$. Thus, a solution $u$ would be expressed in function of each $\Phi_i$ over every $T_i$ such that, $u_i = \sum_{1 \leq j \leq 3} u_{ij}\Phi_{ij}$
Then, how do you compute the following expressions $M_{ij} = \int_{T_i} \Phi_i \Phi_j$ and $B_{ij} = \int_{T_i} \Phi_i \times \Phi_j$ with $1 \leq i, j \leq n_T$ where $n_T$ is the number of triangular mesh elements. $M, B$ being any local matrices.
I'd go for : Expressing $\Phi_i$ as a first order polynomial $\Phi_i = ax + by + c$ and the same for $\Phi_j$ but how do you compute numerically the integration over $T_i$ ?
Additional question : Does a change of coordinate affects local matrices ? i.e DO we need to rewrite the matrices when we perform a change of coordinate
Thanks.
P.S : Sorry for the unrelated tag but I couldn't add something else, the display went wrong.
 A: This answer is to extend my comment above as a full answer.
The basis function of the linear Lagrangian finite element $\mathbb{P}^1$, happens to the barycentric coorinates for the triangle of interest, say $T$ in your case. $\Phi_{j} = 1$ on the $j$-th vertex of $T_i$ ($j=1,2,3$ is the local index of the vertex). Then a widely-cited article in finite element community is On finite element integration in natural co-ordinates. It is behind a paywall unfortunately, so here I reproduce the formula as follows:
For an interval $I$,  $\Phi_j$ was the nodal basis ($1$ on the $j$-th node, $0$ on the other), then:
$$
\int_I \Phi_1^a \,\Phi_2^b \,dx = \frac{a!\,b!}{(a + b + 1)!} |I|.
$$
For a triangle $T$, $\Phi_j$ was the nodal basis for $j$-th vertex, then:
$$
\int_T \Phi_1^a \,\Phi_2^b\, \Phi_3^c\, dA = \frac{a!\,b!\,c!}{(a + b 
+ c + 2)!} 2!|T|.
$$
For a tetrahedron $V$, $\Phi_j$ was the nodal basis for $j$-th vertex, then:
$$
\int_V \Phi_1^a \,\Phi_2^b \,\Phi_3^c \,\Phi_4^d \, dV = \frac{a! 
\, b! \, c! \, d!}{(a + b + c + d + 3)!} 3!|V|.
$$
You can go on and on, which can be generalized to $n$-simplex. 
In your case
$$
\int_T \Phi_i  \,\Phi_j  = \frac{|T|}{12}(1+\delta_{ij}),\tag{1}
$$
where $\delta_{ij}$ is the Kroncker delta.
Notice $\Phi_i$ and $\Phi_j$ are scalars, so the cross product (exterior product), $\Phi_j\times \Phi_i$, is just scalar product. Unless what you mean is:
$$
\int_T \nabla \Phi_i \times \nabla \Phi_j \quad \text{ or } 
\int_T \begin{pmatrix} \Phi_i \\ \Phi_j\end{pmatrix}\times 
 \begin{pmatrix} \Phi_m \\ \Phi_n\end{pmatrix}.
$$
If it is the latter then just apply the wedge product formula for a 2 dimensional vector, and exploit formula (1) for each term.
If it is the former, which is the wedge product (cross product) of the gradient of each nodal basis. Firstly
$$\nabla \Phi_i = -\frac{\mathbf{n}_i}{h_i} =-\frac{|\mathbf{e}_i|\mathbf{n}_i}{2|T|}, $$
where $h_i$ is the height on the edge $\mathbf{e}_i$ opposite to the $i$-th vertex in this triangle, and $\mathbf{n}_i$ is the unit vector normal to the edge $e_i$, pointing outward from the triangle. Hence
$$
\nabla \Phi_i \times \nabla \Phi_j = \frac{|\mathbf{e}_i|\mathbf{n}_i}{2|T|}\times \frac{|\mathbf{e}_j|\mathbf{n}_j}{2|T|} = \frac{1}{4|T|^2} {\mathbf{e}_i\times \mathbf{e}_j}.
$$
This is done by rotating each vector in $ |\mathbf{e}_i|\mathbf{n}_i\times |\mathbf{e}_j|\mathbf{n}_j$ by $\pi/2$. Now $\mathbf{e}_i\times \mathbf{e}_j$ just produces the area times $2$ (Why? one way to think of this is the 3D cross product formula). Hence
$$
\int_T \nabla \Phi_i \times \nabla \Phi_j = \frac{1}{2}.
$$
