BHS Calculus logo

User-Defined Functions

on the TI-89


The Distance Formula:

User-defined functions are a very handy way to simplify routine calculations, such as the distance formula. The distance between the points (h1, k1) and (h2, k2) is : distance formula.

A straightforward way to define a function on the TI-89 is to use the "Define" command, followed by a list of parameters the function uses, followed by the function's result. See below.

After starting a new problem, press <F4> and select "1: Define".

F4 menu + define(

You want to pick a meaningful name for your function, but one that's not too long to type. Although it seems like a good idea, single-letter names can be a problem since NewProb automatically erases them. Actually, long function names aren't a problem, because you can always pick the function name from the <2nd><VAR-LINK> menu.

I picked "dist" for the name of the function - type <2nd><alpha>"dist"<alpha>"(" <alpha> "h1," <alpha> "k1," <alpha> "h2," <alpha> "k2)="

function left side

Now, type the function result, as shown. Then press <ENTER>.

Function right side

Example 1 on p. A11 of the Larsen text is shown at right. ("Find the distance between the points (-2,1) and (3,4).")

You type <2nd><alpha>"dist"<alpha>"(-2,1,3,4)"<ENTER>. To get the approximate result on the last line, press <Diamond><ENTER> instead of just <ENTER>.

P. A11, example 1

A solution is shown at right for Example 3 on p. A12 of the Larsen text. ("Find x such that the distance between (x,3) and (2,-1) is 5.")

The first step uses the "dist" function to write an equation for "the distance between (x,3) and (2,-1) is 5", and the second step uses the solve() function to solve the resulting equation for x. Note that you don't have to type the equation into the solve() function - just use the blue arrow keys to highlight it in the history area and press <ENTER>. It will be copied onto the edit line.

p. a12, example 3

Here is a second solution for Example 3 which skips the intermediate step. You can use whichever method seems more natural to you.

Example 3 on p. A12 of Larsen


The Midpoint Formula:

The midpoint of the segment connecting the points (h1, k1) and (h2, k2) is midpoint formula. You can create a user-defined function on the TI-89 to calculate this as follows:

I thought "mid" would be a good name for this function, but unfortunately, the TI-89 already has a built-in function with that name. I chose the name "mpt" for my function.

Type <F4><Enter> to select "Define", then type <2nd><alpha>"mpt"<alpha> followed by the parameter list and "=" as shown.

left side of the formula

The right side of the function is shown at right. Note that you have to use square brackets (<2nd>",") in order for the function to return point coordinates (actually a matrix...). Press <ENTER> when done.

midpoint formula- right side

A solution to the problem below Example 3 on p. A12 of the Larsen text (find "the midpoint of the segment joining the points (-5,-3) and (9,3)") is shown at right.

Example 3, p. A12


last update November 26, 2007 by JL Stanbrough