# How do I draw a function along with a particular tangent line at a specific point? [duplicate]

I would like to draw a function (x/x^2+1), and at a certain point, i'd like to draw a dot along with the tangent line at that specific point.

what I have tried is the following:

Plot[{function[x], function'[x]}, {x, -5, 5}, AxesLabel -> {x, y} LabelStyle -> Direction[Black, Bold]]


However, this plots the original function f(x) and f'(x) simultaneously; how can I achieve the desired result?

function[x_] := x/(x^2 + 1);

x0 = 1/2;
Plot[{function[x], function[x0] + function'[x0] (x - x0)}, {x, -5, 5},
AxesLabel -> {x, y}, LabelStyle -> Direction[Black, Bold],
Mesh -> {{x0}}, MeshStyle -> Directive[Red, PointSize[Large]]]


• Hey thanks! I'm trying to plot this at point 45, but it doesn't seem to plot the tangent at that point; instead the tangent is on a completely different line with two dots? Commented Feb 24, 2019 at 6:50
• @Jaigus, there was a typo; fixed now. Mesh -> {{1/2}} should be Mesh -> {{x0}}.
– kglr
Commented Feb 24, 2019 at 7:12
• Thanks alot, this works great. Commented Feb 24, 2019 at 7:25
• Alternatively: Plot[{function[x], Normal[Series[function[x], {x, x0, 1}]]} // Evaluate, {x, -5, 5}]. Commented Feb 25, 2019 at 2:04
• @J.M.iscomputer-less, that's much neater.
– kglr
Commented Feb 25, 2019 at 7:04