# Formulas and examples for triangle

## Area of the triangle?

The **area** of a triangle whose vertices
are $A(x_A, y_A), B(x_B, y_B)$ and $C(x_C, y_C)$ is given by :

$$ {\color{blue}{ K = \frac12|x_A(y_B - y_C) + x_B(y_C - y_A) + x_C(y_A-y_B)| }} $$

**Example:**

Find the area of the triangle whose vertices are
$A(2, 4), B(3, -1)$ and $C(-3, 3)$.

**Solution:**

In this example we have:
$ x_A = 2,~~ y_A = 4,~~ x_B = 3,~~ y_B = -1, x_C = -3,~~ y_C = 3$. So we have:

$$
\begin{aligned}
K & = \frac12|x_A(y_B - y_C) + x_B(y_C - y_A) + x_C(y_A-y_B)| \\
K & = \frac12|2(-1 - 3) + 3(3 - 4) -3(4-(-1))| \\
K & = \frac12|2\cdot(-4) + 3\cdot(-1) -3\cdot5| \\
K & = \frac12|-8 - 3 -15| \\
K & = \frac12|-26| \\
K & = \frac12\cdot26 \\
K & = 13
\end{aligned}
$$

## Centroid of the triangle?

The **centroid** of a triangle whose vertices
are $A(x_A, y_A), B(x_B, y_B)$ and $C(x_C, y_C)$ is given by :

$$ {\color{blue}{ (x,y) = \left(\frac{x_A + x_B + x_C}{3}, \frac{y_A + y_B + y_C}{3}\right) }} $$

**Example:**

Find the centroid of the triangle whose vertices are
$A(2, 4), B(3, -1)$ and $C(-3, 3)$.

**Solution:**

Using the same $x_A, y_A, x_B, y_B, x_C, y_C$,
as in previous example we have:

$$
\begin{aligned}
(x,y) & = \left(\frac{x_A + x_B + x_C}{3}, \frac{y_A + y_B + y_C}{3}\right) \\
(x,y) & = \left(\frac{2 + 3 - 3}{3}, \frac{4 - 1 + 3}{3}\right) \\
(x,y) & = \left(\frac{2}{3}, 2\right) \\
\end{aligned}
$$