# Gaussian integration on triangles

I need to integrate by Gaussian rule on a triangle.

Thanks alot.

I have not heard of quadrature rules for a pentagon. However, there is a lot of existing literature about quadrature rules for a triangle. You could use this existing literature by splitting up your integral into a sum of integrals over triangles and then transforming each integral (which would be for some triangle with vertices $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, y_3)$) into an integral over a "reference triangle" (with vertices $(0,0)$, $(1,0)$, $(0,1)$ -- the choice depends on the author).

To transform each integral, you need a map $\mathbb{R}^2 \to \mathbb{R}^2$ which maps $(0,0) \mapsto (x_1, y_1)$, $(1,0) \mapsto (x_2, y_2)$, and $(0,1) \mapsto (x_3, y_3)$:

$$\begin{bmatrix} x \\ y \end{bmatrix} = \begin{bmatrix} x_1 \\ y_1 \end{bmatrix} + \begin{bmatrix} x_2 - x_1 & x_3 - x_1 \\ y_2 - y_1 & y_3 - y_1 \end{bmatrix} \begin{bmatrix} s \\ t\end{bmatrix}.$$

Let $T$ be the arbitrary triangle and $T'$ the reference triangle. Then

$$\int_T f(x, y) \, dy \, dx = \int_{T'} f(g_1(s, t), g_2(s, t)) \, \left| \det J \right| \, dt \, ds,$$

where

\begin{align} g_1(s, t) &= x_1 + (x_2 - x_1) s + (x_3 - x_1) t \\ g_2(s, t) &= y_1 + (y_2 - y_1) s + (y_3 - y_1) t, \text{ and } \\ J &= \begin{bmatrix} \frac{\partial g_1}{\partial s} & \frac{\partial g_1}{\partial t} \\ \frac{\partial g_2}{\partial s} & \frac{\partial g_2}{\partial t} \end{bmatrix} \\ &= \begin{bmatrix} x_2 - x_1 & x_3 - x_1 \\ y_2 - y_1 & y_3 - y_1 \end{bmatrix}. \end{align}

Sources: