Here's a challenge for you:

Write an algorithm -- a step-by-step procedure -- to determine whether a point
is inside a triangle.
The input to the algorithm is eight numbers: the x,y coordinates of a single
point, P and 3 pairs of x,y coordinates giving the corners A, B, and C of the
triangle.

The output from the algorithm is the word "Inside" if the point is inside the
triangle, or the words "Not Inside" if the point is not inside the triangle.

This web page actually contains the algorithm, written in JavaScript.

Try do do the challenge yourself. Then, if you want to check your
answer, look at an explanation of how I
met this challenge. There are examples written in JavaScript, REXX,
and even an Excel Spreadsheet!

### Related Pages in this website

Back to Geometry and Trig

Points and Lines -- answers
questions like finding the equation of a line given a point and a slope, or
another point

Using the determinant of a
matrix to calculate the area of a polygon

Triangle Area using
Determinant

Triangle Area using Vectors

Pythagorean Theorem

The webmaster and author of this Math Help site is
Graeme McRae.