Wolfram Research

Function Repository Resource:

TangentLine

Source Notebook

Compute properties of the tangent line to a curve at a given point

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["TangentLine"][expr,{x,a},{y,b}]

gives an association of properties of the tangent line to expr, viewed as an equation in x and y, at the point {x,y}={a,b}.

ResourceFunction["TangentLine"][expr,{x,a},{y,b},prop]

returns the value of the tangent line property prop.

ResourceFunction["TangentLine"][expr,{x,a},y,]

returns information relating to one, among possibly several, of the tangent lines to expr at x=a.

Details and Options

Allowed values of prop are: "SlopeInterceptEquation", "StandardFormEquation", "PointSlopeEquation", "HorizontalIntercept", "VerticalIntercept", "Plot" and All (default).
If expr does not have head Equal, then expr is treated as an expression defining y in terms of x. In other words, ResourceFunction["TangentLine"][expr,{x,a},y,] is equivaluent to ResourceFunction["TangentLine"][y==expr,{x,a},y,] if expr itself has a head other than Equal.
If no value for y at the intersection point is given, one is inferred. For expressions that are multivalued at x=a, information on only one of potentially several tangent lines is returned unless y is also specified.

Examples

Basic Examples

Compute the slope-intercept equation of the tangent line to a curve at a given point:

In[1]:=
ResourceFunction["TangentLine"][
 y == x^2 + 3, {x, 2}, y, "SlopeInterceptEquation"]
Out[1]=

Visualize this result:

In[2]:=
ResourceFunction["TangentLine"][y == x^2 + 3, {x, 2}, y, "Plot"]
Out[2]=

Compute the slope of this tangent line:

In[3]:=
ResourceFunction["TangentLine"][y == x^2 + 3, {x, 2}, y, "Slope"]
Out[3]=

Compute the horizontal intercept of this tangent line:

In[4]:=
ResourceFunction["TangentLine"][
 y == x^2 + 3, {x, 2}, y, "HorizontalIntercept"]
Out[4]=

Get the standard-form equation of this tangent line:

In[5]:=
ResourceFunction["TangentLine"][
 y == x^2 + 3, {x, 2}, y, "StandardFormEquation"]
Out[5]=

Get an association of properties of a tangent line to a curve:

In[6]:=
ResourceFunction["TangentLine"][Sin[10 x], {x, 2}, y]
Out[6]=

Get just the point-slope equation of this tangent line:

In[7]:=
ResourceFunction["TangentLine"][
 Sin[10 x], {x, 2}, y, "PointSlopeEquation"]
Out[7]=

Scope

The first argument to TangentLine can be an implicit definition of a curve:

In[8]:=
ResourceFunction["TangentLine"][x^2 + y^3 == 5, {x, 2.4}, y]
Out[8]=

Properties and Relations

If a tangent line coincides with a coordinate axis, its intercept with that axis is the set of real numbers:

In[9]:=
ResourceFunction["TangentLine"][x^2, {x, 0}, y, "HorizontalIntercept"]
Out[9]=

If a tangent line is parallel to, but does not coincide with, a coordinate axis, its intercept with that axis is None:

In[10]:=
ResourceFunction["TangentLine"][
 x^2 + 3, {x, 0}, y, "HorizontalIntercept"]
Out[10]=

Requesting tangent line information about a point that is not on the curve will result in an error message:

In[11]:=
ResourceFunction["TangentLine"][
 y == x Sin[x], {x, 2}, {y, 3}, "SlopeInterceptEquation"]
Out[11]=

Possible Issues

Vertical tangent lines (whose slope cannot be computed) are excluded from the results returned by TangentLine:

In[12]:=
ResourceFunction[
 "TangentLine"][Sqrt[x], {x, 0}, y, "SlopeInterceptEquation"]
Out[12]=

This result is despite the fact that this expression has a vertical tangent line at the origin:

In[13]:=
Plot[Sqrt[x], {x, -1, 2}]
Out[13]=

If y is not specified, information on only one of the possible tangent lines at is returned:

In[14]:=
ResourceFunction["TangentLine"][
 x^2 + 3 y^2 == 1, {x, 1/Sqrt[2]}, y, "Plot"]
Out[14]=

To instead choose the other tangent line at , specify the corresponding value of y:

In[15]:=
ResourceFunction["TangentLine"][
 x^2 + 3 y^2 == 1, {x, 1/Sqrt[2]}, {y, 1/Sqrt[6]}, "Plot"]
Out[15]=

Resource History

See Also

License Information