Graphing Simple Functions Tutorial


Graph representation of Newton's Law of universal gravitation
Panel 1
\(F = G(m_1m_2)/r^2\)

Developing a facility for graphing functions is very important in all branches of science. It allows you very quickly to get an insight into how certain physical laws behave. For example, if I say that Newton's Law of universal gravitation is \(F = G(m_1m_2)/r^2\) and asked you to describe in some detail how \(F\) varies with distance \(r\), you might have some difficulty making your thoughts clear. But if you look at Panel 1, you will see that the graph on the right contains a great deal of readily interpretable information. For example, \(F\) gets small as \(r\) gets large and \(F\) gets large as \(r\) gets small. You'll notice that I haven't put any numbers along the \(F\) and \(r\) axes. Indeed, I haven't put any scale indications of any kind.

I'm interested in the form of the dependence of \(F\) on \(r\), not on numerical details for a specific case. Putting in numbers for \(G\), \(m_1\) and \(m_2\), and then finding various values of \(F\) for various assumed values of \(r\), and plotting the points on graph paper is not what I'm talking about. That's a tedious method involving an unnecessary amount of work. And all this work doesn't help you understand the physical principles any better. Nevertheless, sometimes calculating a few points will help to elucidate the shape of the graph. But don't do it to the exclusion of the kind of reasoning I'm advocating here.

Values for Force law graphed
Panel 2 
Assume \(G = 1, m_1 = 1, m_2 = 1\)
then: \( F = 1/r^2\)

In Panel 2, I've set up a table of values for the force law, and you can see that a lot of unnecessary arithmetic is involved. By the way, my choice of \(G = 1Nm^2/kg^2\) is, of course, ridiculous. But I didn't want to get involved with the complicated numbers. Study Panel 2 for a moment in order to see what I've done.

What is contained in Panel 2 is what we are not going to do. We want to proceed right to the graph you saw in Panel 1 without very much number crunching.

Since we want to investigate how \(F\) varies with \(r\), with all other things constant, let's strip away all the unnecessary things and conceal them in one constant \(k\). In other words, \(Gm_1m_2 = k\). The next thing to do is draw the axes.

Special cases for F plotted
Panel 3
\(F = G(m_1m_2)/r^2 \Rightarrow F = k/r^2\)

Now look at some special cases. For example, what does \(F\) become if \(r\) is made very large? The answer is obviously that \(F\) is very small. That is, if \(r\) tends to infinity, \(F\) tends to 0, and I've indicated that on the axes in Panel 3. What does \(F\) become if \(r\) is made very small? Obviously, \(1/r^2\) becomes very large so \(F\) becomes very large. I've indicated this on the axes in Panel 3 as well. As \(r\) increases from a small value, \(F\) decreases rapidly, but smoothly.

F and r plotted
Panel 4

Clearly, as \(r\) goes from very small to very large, \(F\) varies smoothly between these two as I have indicated in Panel 4. Notice nothing was said about restricting \(r\) to positive values so I've also sketched the curve in the region of \(-r\). The result is shown in Panel 4; study Panel 4 to make sure you understand how we got it.

Let's do another example just for practice. Without looking at your book, see if you can sketch \(y\) vs \(x\) for \(y = ax^3\) where a is a positive constant. Try it before you go on.

y = ax3
Panel 5
\(y = ax^3\)

Let's now look at Panel 5 to see if you sketched it properly. First of all, notice that when I say \(y\) vs \(x\), I always mean to have \(x\) as the independent variable and plot it horizontally, it's sometimes called the abscissa, and \(y\) is plotted vertically; it's sometimes called the ordinate. Notice first that at \(x = 0\), \(y = 0\) so the curve must go through the origin. Now, when \(x\) is large and positive, then \(ax^3\) and thus \(y\), is very large and positive and gets even larger with larger \(x\), so we're able to sketch in the right-hand portion. Notice that as \(x\) increases, \(y\) also increases but at a greater rate because of the \(x^3\) term. This is how we determine the general form of the graph. Now, if \(x\) gets increasingly negative, then \(ax^3\) gets very large but negative and you can see how we got the left-hand portion of the graph.

polynomial graphed
Panel 6
\(y = (x-5)(x+6)\)

One more example will illustrate a few more useful points. Let's look at the polynomial \(y = (x - 5)(x + 6)\) as shown in Panel 6. First of all, let's look at the infinity limits. As \(x\) becomes increasingly large in either the positive or negative direction, then y gets very large in the positive direction. Further, you can see that \(y = 0\) if \(x = 5\) because of the \(x - 5\) term, and it's also \(0\) at \(x = -6\), so our curve must go through these two points. Finally, if \(x = 0\), then \(y = -30\) and this must also be a point on the curve. The curve can now be sketched in as shown.

You might ask, how did I know to put the minimum slightly to the left of the \(x = 0\), \(y = -30\) point? Well let's look at that problem. This is an added refinement that won't always be necessary but it helps. You'll remember from your calculus course that the minimum or maximum in a curve is that point where the derivative of the function describing the curve is \(0\). That is, the tangent to the curve is horizontal.

\(y = (x-5) + (x+6) \)

\(dy/dx = (x-5)(1)+(x+6)(1) = 2x+1\)

\(2x+1 = 0; x = -1/2\)

Look at the equations above. Taking the derivative of the product, \((x - 5)(x + 6)\), with respect to \(x\), gives us \(x - 5\) times the derivative of \(x + 6\) (which is 1) plus \(x + 6\) times the derivative of \(x - 5\) (which is also 1). Thus the derivative of y with respect to \(x\) is \(2x + 1\). Now, setting this equal to \(0\), we find \(x = -1/2\). This is the point then at which the curve has a maximum or minimum. Since the curve has no maximum, it must be a minimum.

plot of a straight line
Panel 7
\(y = mx+b\)

Now, there is one very important graph which you must become familiar with and that's shown in Panel 7. \(y = mx + b\) is the conventional way of writing it; it is, of course, the equation of a straight line. Notice that if \(x = 0\), \(y = b\). \(b\) is called the "\(y\) intercept". The quantity \(m\) is called the "slope" of the line.

 F = ma; V=V0+at; x = vt
Panel 8
\(F = ma \)\(v = v_0 +at\)\(x = vt\)

You must become adept at recognizing straight line relationships and I've shown a few in Panel 8. Study these 3 examples taken from elementary mechanics and see that you understand them.

Notice in Panel 8 we did not plot \(x\) horizontally in the \(x = vt\) graph. The independent variable was \(t\) so it was the abscissa.

F = gm1m2/r2 can this be plotted as a straight line?
Panel 9
\(F = g(m_1 m_2) / r^2\)

In science, we very much like to plot physical relationships as straight lines and you will be asked in your courses to devise ways of plotting certain functions as linear relationships.

Let's look now at how to go about this.

We'll look at the first relation we started with. \(F = g (m_1 m_2) / r^2\). Is it possible to plot this in such a way as to yield a straight line? The answer is yes. Let's make a transformation as shown in Panel 9. Let \(y = F\) and let \(x = 1/r^2\). Now we see that \(y\) vs \(x\) is a straight line relation. We must notice that \(x\) is never permitted to be negative in this case since it is \(1/r^2\) so the dashed part of the line does not exist. We must watch out for little things like that. This graph we have shown contains all the information that was shown in the graph of Panels 1 or 4.

straight line y = ax3
Panel 10
\(y = ax^3\)

How do we linearize the expression in Panel 5, \(y = ax^3\)? Well, if we plot \(y\) vs \(x^3\), we'll get a straight line. I've shown this in Panel 10. In this case, there is a negative part to the graph since for positive \(x\), \(x^3\) is positive but for negative \(x\), \(x^3\) is negative. Note also that the slope of this graph is \("a"\) and this might be a reason for plotting such a graph. \("a"\) might be a number which we want to determine from a set of experimental data of \(x\) and \(y\) which obeys the law \(y = ax^3\). The easiest way to get a is to make the graph as we have it here and find the slope.

y2 = 1/4b + 4/3 ax3
Panel 11
\(y = (1/4)b + (4/3)ax^3\)
\((y^2 - b/4)^{\frac 12} = (4a/3)^{\frac 12} x^{\frac 32}\)

How about the expression \(y^2= 1/4 b + 4/3 ax^3\) as shown in Panel 11. There's sometimes more than one way to treat an expression. We could plot \(y^2\) vs \(x^3\) and you would get a line of \(y\) intercept \(1/4 b\) and slope \(4/3 a\). You could, however, take the square root and plot the square root of \(y^2- 1/4 b\) vs \(x ^ {\frac 32}\). You would again get a straight line, this time through the origin, and having a slope which is the square root of \(4/3 a\). Notice that because of the \(x^{\frac32}\), you couldn't represent the negative values of \(x\). Study Panel 11 carefully.

Finally, let's look at the expression \(N = N_0e^{at}\), the exponential relation. This relation arises very often in science. For example, bacterial growth behaves this way. The number of bacteria doubles every generation so if there are \(N_0\) bacteria now, there are \(2N_0\) sometime later and \(4N_0\) an equal time after that and so on. This behaviour is described by this equation.

For \(t = 0\), \(N = N_0e^0\) which is just \(N_0\), so this point is on the curve as shown in Panel 12.

For t approaching infinity, N also approaches infinity, very rapidly.
Panel 12
\(N = N_0 e^{at}\)

For \(t\) approaching infinity, \(N\) also approaches infinity, very rapidly. For \(t\) approaching negative infinity, \(N\) approaches 0 and is positive. So using these data, I can sketch the curve in Panel 12.

Panel 13
\(ln(N/N_0) = at\)

How do we linearize the exponential relation?

The secret here is to take the natural log of each side and get \(ln(N/N_0) = at\). If you plot \(ln(N/N_0) \)vs \(t\), you'll get a straight line of slope \(a\). This is shown in Panel 13.

Sometimes it's a nuisance to calculate a bunch of logarithms so we use a special type of graph paper which does this automatically. A discussion on how to use this paper is given in another tutorial which is called "graphing with logarithmic paper".