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

This question already has an answer here:

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?

## marked as duplicate by J. M. will be back soon♦ plotting StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); Mar 13 at 2:19

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? – Jaigus Feb 24 at 6:50
• @Jaigus, there was a typo; fixed now. Mesh -> {{1/2}} should be Mesh -> {{x0}}. – kglr Feb 24 at 7:12
• Thanks alot, this works great. – Jaigus Feb 24 at 7:25
• Alternatively: Plot[{function[x], Normal[Series[function[x], {x, x0, 1}]]} // Evaluate, {x, -5, 5}]. – J. M. will be back soon Feb 25 at 2:04
• @J.M.iscomputer-less, that's much neater. – kglr Feb 25 at 7:04