NOTE: This lesson is also obtainable as executable worksheets ~ above CoCalc. First, produce an account and also a project. Then you deserve to copy these papers to your project and start working best away. 07-tangent.ipynb (Jupyter Notebook) and also 07-tangent.sagews ( Worksheet).

You are watching: Estimate the slope of the graph at the points (x1, y1) and (x2, y2)

In your experience with mathematics for this reason far, you have most likely come throughout the task of calculating the slope between two points. Whether you recognize it as "rise end run" or "change in y over readjust in x", the formula


will provide you the slope between points (x1, y1) and also (x2, y2). Therefore if, for instance, us were to calculation the slope between two points on f(x) = x3/2, say (0, 0) and also (2, 4), us would uncover that by the formula, (4 - 0)/(2 - 0) offers us a slope of 2, together pictured top top the adhering to graph. Because that a objective that will later be revealed, however, what if we were to find the slope of the role at a single point -- at (1, 1/2)? together is the nature of the tangent line difficulty that us are around to explore, and also is one of the simple questions that calculus.


quite than simply generating a static graph this time, we"ll be doing a bit of manipulation. In a brand-new worksheet called 06-Tangent Lines, copy/paste the adhering to code and evaluate it.

x1 = 0x2 = 2def f(x): return (x^3)/2y1 = f(x1)y2 = f(x2)slope = (y2-y1)/(x2-x1)p = plot(f(x), x, 0, 3)pt1 = point((x1, y1), rgbcolor=(1,0,0), pointsize=30)pt2 = point((x2, y2), rgbcolor=(1,0,0), pointsize=30)d = 3l = line(<(x1-d, y1-d*slope), (x2+d, y2+d*slope)>, rgbcolor=(1,0,0))t1 = text("(%s, %s)" % (float(x1), float(y1)), (x1+0.5, y1-0.8), rgbcolor=(1,0,0))t2 = text("(%s, %s)" % (float(x2), float(y2)), (x2+0.5, y2-0.8), rgbcolor=(1,0,0))t3 = text("slope: %s" % float(slope), ((x1+x2)/2-0.5, (y1+y2)/2), rgbcolor=(1,0,0))g =, xmax=3, ymin=-1, ymax=9) Toggle Explanation Toggle line Numbers 1-2) collection the 2 x-coordinates 4-5) develop a duty f(x) = x3/2 7-8) calculation y1 and also y2 based on the duty f(x) 10) calculation for slope 12) Plot f(x) ~ above the interval <0, 3> 13-14) attract (x1, y1) and (x2, y2) on the graph 16-17) draw a secant line between the 2 points. "d" affects the line"s size 19-21) screen the place of the two points and also the slope between them. (%s merely means, "replace me v the worth inside the complying with variable".) 23-24) integrate the plot, points, line, and text and show castle in a solitary graph.

In the graph, the right line that passes v the two points is called a secant heat -- we can say that it is one approximation that the function"s slope in ~ the allude (1, 1/2), albeit not a very great one. What we desire is a heat tangent come the role at (1, 1/2) -- one that has actually a slope same to that of the function at (1, 1/2).

To acquire a much better approximation that the steep at the point, let"s try decreasing the distance between the two points at either next of it. In the very first cell of your worksheet, change x1 come 0.5 and also x2 to 1.5 and also evaluate. Her graph should now look at something prefer the following image:


as you can see, the secant line in this graph tho does no pass with the desired point of (1, 1/2), but at the very least we are obtaining closer. Now, try setting x1 together 0.999 and also x2 as 1.001 and also again evaluate the cell. As well as looking cramped, what else can you observe about this graph? Ah ha! girlfriend surely say, the looks prefer the slope at (1, 1/2) is just about equal come 1.5000005. Us could, the course, repeat this process in perpetuum, because when only a billionth that a unit off the two points, there is tiny doubt that the calculated steep does, in fact, roughly equal the slope of f(x) = x3/2 at (1, 1/2).

Let us skip that theoretical headache, however, and also consider a much quicker (and even an ext accurate!) method. Look again in ~ the formula because that calculating slopes, this time in a slightly altered form:


rather than skip the relationship between the 2 points, together in the very first form, this formula relies upon it. The price y2 is currently f(x + h), and y1 is f(x). The major difference here, though, is that x2 has been replaced by the first x add to some readjust "h". The slope formula"s premise still stands, however, as the new type does in reality calculate adjust in y over adjust in x.

therefore what have the right to we perform with this brand-new formula, girlfriend ask? Well, what us would choose to execute is to make the change in x (designated by h) equal to zero in bespeak to find the function"s slope at a single point. Exchanging 0 because that h does not work-related well, however, since that would make the formula just (f(x + 0) - f(x))/0, i m sorry is no of much help (0/0 = ?). Let united state consult, though, and also see if over there is a method to variable out h before setting it same to zero. In a new cell, copy or form the following code.

def f(x): return (x^3)/2var("x, h")(f(x + h) - f(x))/h Toggle Explanation Toggle line Numbers 1-2) collection f(x) together x3/2 4) Initialize variables x and h 5) advice (f(x + h) - f(x))/h

The result should look favor this: ((x + h)^3/2 - x^3/2)/h. With h still in the denominator, though, replacing it with zero would certainly not it is in a great idea. Luckily, has a method for united state to pull every variables native the denominator come the numerator, which is just what we need. In one more cell, type and evaluate the following:

((f(x + h) - f(x))/h).rational_simplify() The result should be (3*x^2 + 3*h*x + h^2)/2. Currently that h is in the numerator, replacing it v zero will offer us a formula for the function"s slope at any value of x. To establish this result, include ".subs(h=0)" there is no the price quotes to the end of rational_simplify() in the critical entry and again advice the cell. And also there you have actually it! By relenten the adjust in x together a number "h", us were maybe to leveling the formula because that slope and replace h v zero in stimulate to uncover that the steep of the function"s tangent line at any kind of x-coordinate is same to 3*x2/2. This result expression is known as the derivative the f(x) = x3/2. You"ll learn an ext about derivatives in the following section, but for currently you should know that a function"s derivative actions rate of adjust at a point.

To complete what we had actually originally set out come do, plug in a worth of 1 because that x, now, and also you will check out that the steep of the heat tangent to the point (1, 1/2) top top f(x) = x3/2 is 3/2. This confirms our earlier experimentation through numerical analysis in enhancement to being specific solution. If we were to write an equation because that this tangent heat in slope-intercept form, it would be


It"s very important come remember the the equation for a tangent line have the right to always be composed in slope-intercept or point-slope form; if you find that the equation because that a tangent heat is y = x4*x²+e + sin(x) or part such extreme, something has actually gone (horribly) wrong. The steep of a tangent heat will always be a constant.

You most likely wouldn"t it is in surprised to find out that this symbolic procedure involved a limit, especially "the limit of (f(x + h) - f(x)))/h as h viewpoints zero." The slope the we found is also known as the derivative that f(x) in ~ x=1. Look at at just how the tangent heat lies against the graph of f(x) = x3/2:

(plot(x^3/2, x, 0, 2)+plot(3*x/2-1, 0, 2, rgbcolor="red")+point((1, 1/2), gbcolor="black", pointsize=30)).show(xmin=0, xmax=2, ymin=-1, ymax=4) Toggle Explanation Toggle line Numbers 1-2) Plot the original function with the tangent line and a allude to display where castle touch.

now that us have specific methodology for computer the slope of a tangent line, consider the function

What is the equation because that the line tangent to (-2, g(-2))? The steep of the tangent line can be discovered using the function"s derivative:

(plot(3/x, x, -3, 0)+plot(-3*x/4-3, -3, 0, rgbcolor="red")+point((-2, -3/2), rgbcolor="black", pointsize=30)).show(xmin=-3, xmax=0, ymin=-10, ymax=0) Toggle Explanation Toggle line Numbers 1-2) Plot the original function with that is tangent line and a point to display where they touch.

Practice Problems

See more: How Tall Is A 16 Oz Water Bottle And Label Size Information, How Tall Is A Costco Water Bottle

use the limit procedure to discover the equation that the heat tangent come the indicated point. 1)
in ~ x=2. Toggle price 2)
at x=-1. Toggle answer 3)
at t=5. Toggle answer