# Knowledge Base

## Solution 12218: Median-Median Line Algorithm on TI Graphing Calculators.

### What method is used to calculate the median-median line?

The goal of the median-median line is to:

1) Divide the data into three parts with an equal number of data points
2) Define a summary point for each part
3) Use the three summary points to define the median-median line

How TI graphing calculators do this:

1) The calculator will attempt to break the list into three equal parts without breaking up data groups of equal x values.  In this case, the algorithm we use is designed to include at least 1/3 of the points in the left and right groups. Whatever is left over is then put into the center group, hopefully the remaining 1/3. The approach chosen was to fill the outside groups first and allocate the remaining data points to the center group. If the center group is empty, an error message is generated.

The reason equal x values are not split up is to ensure that the same results are produced regardless of the order the data appears in the original list. Without this restriction, a different result could be produced depending on the ordering in the data input lists.

2) A summary point is simply the median of all x values and y values in that part. Call the summary points (x1,y1), (x2,y2), and (x3,y3).

3) The median-median line will be parallel to the line going through the points (x1, y1) and (x3, y3)
a = (y3 - y1) / (x3 - x1)
and 1/3 the distance between the line through the two summary points and a parallel line going through the second summary point (x2, y2).
b = (y1 + y2 + y3 - a (x1 + x2 + x3)) / 3.

An advantage of the median-median line over a least-squares line is that stray data points do not affect the end result very much.