Next: Split line segment AB Up: Examples Previous: Linear equation y = Contents Index

# Centroid of three points A, B, C

We are now going to construct the centroid of three points by entering the following lines in the input text field (press enter at the end of each line). Of course, you can also use the mouse to do this construction using the modes (see 3.2) in the toolbar.

        A = (-2, 1)
        B = (5, 0)
        C = (0, 5)
        M_a = Midpoint[B, C]
        M_b = Midpoint[A, C]
        s_a = Line[A, M_a]
        s_b = Line[B, M_b]
        S = Intersect[s_a, s_b]

Alternatively we compute the centroid directly as

        S1 = (A + B + C) / 3

and compare both results using the command

        Relation[S, S1]

Subsequently we experiment whether S = S1 is true for other positions of A, B, C as well. We do this by choosing the move mode with the mouse (leftmost button in the toolbar) and dragging one of the points.