Approach of the Secant Lines

On this page I will show you how I coded the approach of the secant line image.

First graph your curve

curve( x^2, from = -1, to = 5, main = expression(paste('plot of ',' ', x^2)), ylab = 'y')

Next you need to identify the equations of the secant lines. I chose x = 4 and x = 3, you can use the definition of the slope and point-slope form to identify m and b

curve( x^2, from = -1, to = 5, main = expression(paste('plot of ',' ', x^2)), ylab = 'y')

abline(-8,6,col = 'red',lwd = 2.5)
abline(-6,5, col = 'blue', lwd = 2.5)
abline(0,2, col = 'green', lwd = 2.5)

The col function specifies the color, and the lwd function specifies how thick the line is.

Lastly, we need to add text labels to our graph

curve( x^2, from = -1, to = 5, main = expression(paste('plot of ',' ', x^2)), ylab = 'y')

abline(-8,6,col = 'red',lwd = 2.5)
abline(-6,5, col = 'blue', lwd = 2.5)
abline(0,2, col = 'green', lwd = 2.5)
text(4.2,22.8,expression(paste('plot of ',' ', x^2)),cex=0.75)
text(3.2,14.4, 'y = 6x-8', cex =0.75, col = 'red')
text(2.2,9,'y = 5x-6',cex = 0.75, col ='blue')
text(1.2, 5.8, 'y = 2x', cex = 0.75, col = 'green')