# Drawing a curve tangent to a line

I'd like to draw a set of curves, each tangent to a different point on a given line. The requirement is that the curves are convex and downward sloping.

In the following MWE, I use the to[out=<x>,in=<y>] operation to manually adjust the slope of the curves so that they appear to be tangent at the desired point. This requires a lot of trial-and-errors and the result is not ideal. Is there a better way to draw such curves?

# MWE

\documentclass[border=2pt,tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\foreach \i in {1,2,3,4}{
\draw[thick](0,4.5)--(7,0)coordinate[pos=\i/5](\i);
\draw[red](\i)to[out=140,in=-80]++(-1,1.5) (\i)to[out=-25,in=170]++(1.25,-.4);
}
\draw[<->](0,5)node[left]{$y$}--(0,0)--(8,0)node[below]{$x$};
\end{tikzpicture}
\end{document} You could use decorations.marking, which transforms you automatically in tangent space. Then you just need to draw a curve which has slope 0 at (0,0).

\documentclass[border=2pt,tikz]{standalone}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[touching curve at/.style={postaction=decorate,
decoration={markings,mark=at position #1 with
{\draw[touching] (-1,0.5) to[out=-45,in=180] (0,0) to[out=0,in=-135] (1,0.5);}}},
touching/.style={red}]
\draw[thick,touching curve at/.list={1/5,2/5,3/5,4/5}](0,4.5)--(7,0);
\draw[<->](0,5)node[left]{$y$}--(0,0)--(8,0)node[below]{$x$};
\end{tikzpicture}
\end{document} 