The Math Forum

Ask Dr. Math - Questions and Answers from our Archives
Associated Topics || Dr. Math Home || Search Dr. Math


Date: 06/15/2003 at 14:05:42
From: Khoa Phung
Subject: How can I visualize the distance between two functions

Dear Dr. Math,

What does the distance between two functions mean? 

Let f(x)=x and g(x)=x^2 on the interval from 0 to 1. 
Then d(f,g) = 1/sqrt(30).
Sqrt( Integral((x-x^2)^2)dx). 

How can I visually understand the inner product of the distance of 
those two functions? 

Date: 06/20/2003 at 15:40:02
From: Doctor Douglas
Subject: Re: How can I visualize the distance between two functions

Hi Khoa,

thanks for writing to the Math Forum.

The quantity that you have computed above is the "L-2 distance" or the 
"root-mean-square distance" between the two functions f and g on the 
interval (0,1). More generally, you can define an L-p distance as
                  b                    (1/p)
   ||f-g||_p = [ INT |f(x)-g(x)|^p dx ]
                  a                     .
The most common value of p is 2. You may also wish to divide by the 
length |b-a| of the interval before taking the root. In your example, 
the distance is the "root-mean-square" of the distance between the 
function values f(x) and g(x): we take the difference [f(x)-g(x)], 
square it, take the mean value of the squares by dividing by the 
length of the interval, and then finally take the square root of that 
mean to get the distance back in units of the function values (i.e. in 
units of f or g).

Thus, the distance 1/sqrt(30) is the average distance between the two 
functions f and g in this root-mean-square sense.  

Now, if we had wanted the average distance between f and g, we could
have computed [1/(b-a)] INT f(x)-g(x) dx. For the example above, this 
would have worked and given us a number that we could have called the 
average distance. Although it doesn't happen in your example, note 
that in general the integrand of this last integral can take both 
positive and negative values, so that the positive difference over one 
part of the interval can be cancelled by the negative difference 
(g > f) over another part of the interval. Thus the average distance 
can be zero even though f and g are not identical to one another. 

The average distance can also be negative. That doesn't seem like a 
typical use of the word "distance."

This explains why the root-mean-square is useful - all of the 
discrepancies between f and g contribute to the total distance with 
the same sign, because the differences are squared. Loosely speaking, 
a root-mean-square distance of zero implies that f=g over all of the 
interval, except possibly at a few isolated points. And this is a 
useful property to have in a definition of distance - if the distance 
is zero, then the two things are at the same place.

- Doctor Douglas, The Math Forum 
Associated Topics:
High School Functions

Search the Dr. Math Library:

Find items containing (put spaces between keywords):
Click only once for faster results:

[ Choose "whole words" when searching for a word like age.]

all keywords, in any order at least one, that exact phrase
parts of words whole words

Submit your own question to Dr. Math

[Privacy Policy] [Terms of Use]

Math Forum Home || Math Library || Quick Reference || Math Forum Search

Ask Dr. MathTM
© 1994- The Math Forum at NCTM. All rights reserved.