# Drawing an Inflection Point with Tikz

I am trying to draw a point of inflection with this program:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=1]
\draw[->] (-.5,0)--(6,0) node[below] {$x$};
\draw[->] (0,-.5)--(0,6) node[left] {$y$};
\coordinate (1) at (.5,2.75);
\coordinate (2) at (1.5,4.5);
\coordinate (3) at (3,3);
\coordinate (4) at (4.5,1.5);
\coordinate (5) at (5.5,3.25);
\draw [name path=curve,red,thick,-] (1) to[out=80,in=180] (2)
to[out=0,in=135] (3) to[out=315,in=180] (4) to[out=0,in=260] (5);
\draw[fill] (3,3) circle (2pt) node[above right] {$P$};
\end{tikzpicture}
\end{center}
\end{document}


This outputs: You can see a small "kink" in the graph

How can I get the plot smoother at the point P? As in

Here is a minimal modification of your code using the sin and cos paht constructions, which are explained in section 2.12 of the pgfmanual.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=1]
\draw[->] (-.5,0)--(6,0) node[below] {$x$};
\draw[->] (0,-.5)--(0,6) node[left] {$y$};
\coordinate (1) at (.5,2.75);
\coordinate (2) at (1.5,4.5);
\coordinate (3) at (3,3);
\coordinate (4) at (4.5,1.5);
\coordinate (5) at (5.5,3.25);
\draw [red,thick,-] (1)sin (2)
cos (3) sin (4) cos (5);
\draw[fill] (3) circle (2pt) node[above right] {$P$};
\end{tikzpicture}
\end{center}
\end{document}


Of course, you can also plot a function....

• yes I thought about a function but chose this way and then had the problem. I will read the manual where you indicated. It works for me. – MathScholar Jan 2 at 19:17

Just choose more accurate values for the in and out around the inflection point, like .. in=120] (3) to[out=300 .., and add some looseness for more smoother curve.

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=1]
\draw[->] (-.5,0)--(6,0) node[below] {$x$};
\draw[->] (0,-.5)--(0,6) node[left] {$y$};
\coordinate (1) at (.5,2.75);
\coordinate (2) at (1.5,4.5);
\coordinate (3) at (3,3);
\coordinate (4) at (4.5,1.5);
\coordinate (5) at (5.5,3.25);
\draw [red,thick,looseness=.8] (1) to[out=80,in=180] (2)
to[out=0,in=120] (3) to[out=300,in=180] (4) to[out=0,in=260] (5);
\draw[fill] (3,3) circle (2pt) node[above right] {$P$};
\end{tikzpicture}
\end{center}
\end{document}


Since you drew this curve by approximation, I show you another way to draw this same curve by approximation.

Bezier curves can be used by indicating the control points for the start and finish point (as indicated on page 140 of the manual). Here, only the starting points (1) and arrival points (5) are sufficient, the others are useless.

I drew the tangents used by the Bézier curve in cyan. To place the inflection point, always by approximation, I used the decorations.markings library.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{center}
\begin{tikzpicture}[decoration={
markings,
mark=at position .55 with \fill circle (2pt) node[above right] {$P$};}]
\draw[->] (-.5,0)--(6,0) node[below] {$x$};
\draw[->] (0,-.5)--(0,6) node[left] {$y$};
\coordinate (1) at (.5,2.75);
\coordinate (5) at (5.5,3.25);

\draw[postaction={decorate}] (1) ..controls +(75:7) and +(-110:6)..(5);
\draw[cyan,->] (1) -- +(75:7);
\draw[cyan,<-] (5) -- +(-110:6);
\end{tikzpicture}
\end{center}
\end{document}

• All of you have been great for giving a good answer to the user's question. My most sincere appreciation. – Sebastiano Jan 2 at 20:25
• Thank you very much, I always try to be as simple and clear as possible, professional deformation obliges me :-) – AndréC Jan 2 at 20:31

Using geometric transformations is my favourite (in this case, P(2,2) is the center of symmetry).

\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[->] (-.5,0)--(4,0) node[below] {$x$};
\draw[->] (0,-.5)--(0,4) node[left] {$y$};
\def\rightpath{
(2,2) ..controls +(-70:.5) and +(-100:2)..  (3,2.5)
}
\draw[red,thick]\rightpath;
\draw[red,thick,rotate around={180:(2,2)}]\rightpath;
\draw[dashed] (2,2)--(2,0) node[below]{$x_0$}
node[below=3mm,red]{$f''(x_0)=0$};
\fill (2,2) circle (2pt) node[above right] {$P$};
\end{tikzpicture}
\end{document}