# Domain and range

I would like to draw in TeX the following, but I'm pretty new at tikz therefore I have no clue.

I would like to give the geometrical interpretation of the domain and the range of a function. That is that every element of the function that is defined on that has an image on the axis x'x , and that every element that is evaluated on that particular x, has an image on y'y.

How do I do that? I would also like to have some arrows indicating the whole process.

Question: Why can I not write the math symbols in LaTeX here?

(source: ebooks.edu.gr)

Edit: I want to draw the first two pictures in Tikz, not the third one! Hope this helps.

Thank you in advance. Any help would be appreciated.

• Welcome to TeX.SX! As for why code isn't rendered by MathJax, see meta.tex.stackexchange.com/questions/1272/… As for your actual question, do you have a sketch of what you want to achieve? And if you're able to do any part of it, could you add that code to your question? – Torbjørn T. Sep 20 '14 at 9:23
• I can't do the code of the question. I'm truly sorry. How do I upload images? – Tolaso Sep 20 '14 at 9:24
• There is a button just above the text field, click that to upload an image. When that is done you get something like ![enter description][1], you need to remove the ! I think, as users with <10 rep can't add images to posts. – Torbjørn T. Sep 20 '14 at 9:34
• This should not be closed yet. Please wait at least 24 hours after asking the OP for improvements to the question before voting to close. Also, if you downvote, please don't forget to revert the vote after the question is improved. – Martin Schröder Sep 20 '14 at 9:56
• No, but there aren't always people that 1) has seen your question, 2) knows/can figure out how to answer and 3) has the time to write a proper answer. I'd advice a little bit of patience, it is only a couple of hours since you posted the question. – Torbjørn T. Sep 20 '14 at 11:46

Not the most elegant code, there's a bit of trial and error and code repetition, but it does the job.

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{intersections,backgrounds}
\begin{document}

\begin{tikzpicture}

\draw [thick,-stealth] (-0.5,0) --node[below]{$A$} (4,0) node[below]{$x$};
\draw [thick,-stealth] (0,-0.5) -- (0,3) node[left]{$y$};
\node [below left] at (0,0) {$0$};

\draw [ultra thick, red] (0.5,0) -- (3.5,0);

\coordinate (start) at (0.499,0.7);
\coordinate (stop) at (3.501,2.5);

\draw [name path=curve] (start) to[out=-35,in=190] node[pos=0.6,above left] {$C_f$} (stop);

\foreach \x in {0.5,1,...,3.5}
{
\path [name path=line] (\x,0) -- (\x,3);
\draw [name intersections={of=curve and line},dashed,-stealth]
(intersection-1) -- (\x,0);
}

\begin{scope}[xshift=6cm]
\draw [thick,-stealth] (-0.5,0) --  (4,0) node[below]{$x$};
\draw [thick,-stealth] (0,-0.5) --node[left]{$f(A)$} (0,3) node[left]{$y$};
\node [below left] at (0,0) {$0$};

\draw [ultra thick, red] (0,0.52) -- (0,2.5);

\coordinate (start) at (0.499,0.7);
\coordinate (stop) at (3.501,2.5);

\draw [name path=curve] (start) to[out=-40,in=190] node[pos=0.6,below right] {$C_f$} (stop);

\foreach \y in {0.52,.916,...,2.5}
{
\path [name path=line] (0,\y) -- (4,\y);
\draw [name intersections={of=curve and line},dashed,-stealth]
(intersection-1) -- (0,\y);
}

\end{scope}

\end{tikzpicture}
\end{document}
\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{positioning,calc}
\begin{document}
\begin{tikzpicture}
\coordinate (O) at (0,0);
\draw[-latex] (-1,0) node[below right = 0mm and 5mm] {$O$} --
node[pos=0.55,below]{$A$} (10,0)node[pos=0.99,below] {$x$};
\draw[-latex] (0,-1)  -- node[pos=0.99,left] {$y$}(0,8);
\node[fill,circle,inner sep=2pt] (a) at (2,3) {};
\node[fill,circle,inner sep=2pt] (b) at (8,6) {};
\foreach \x [count=\y]in {0,0.05,...,1.05}{
\draw (a.center) to [out=-45, in=180]node[pos=\x] (\y){}
node[pos=0.5,above=1mm]{$C_{f}$} (b.center)
;
\draw[dashed,-latex] (\y) -- (\y|-O);
\draw[very thick,red] (a|-O) -- (b|-O);
}
\node at (5,-1) {($\alpha$)};

\begin{scope}[xshift=12cm]
\coordinate (O) at (0,0);
\draw[-latex] (-1,0) node[below right = 0mm and 5mm] {$O$} --
(10,0)node[pos=0.99,below] {$x$};
\draw[-latex] (0,-1)  -- node[pos=0.55,left]{$f(A)$} node[pos=0.99,left] {$y$}(0,8);
\node[fill,circle,inner sep=2pt] (a) at (2,3) {};
\node[fill,circle,inner sep=2pt] (b) at (8,6) {};
\foreach \x [count=\y]in {0,0.1,...,1.05}{
\draw (a.center) to [out=-45, in=180]node[pos=\x] (\y){}
node[pos=0.5,below=1mm]{$C_{f}$} (b.center);
\draw[dashed,-latex] (\y) -- (\y-|O);
\draw[very thick,red] (4-|O) -- (b-|O);
}
\node at (5,-1) {($\beta$)};
\end{scope}
\end{tikzpicture}
\end{document}

\documentclass[pstricks,border=20pt,12pt]{standalone}
\usepackage{pst-plot,pst-node}
\psset
{
algebraic,
ticks=none,
labels=none,
xAxisLabel=$x$,
yAxisLabel=$y$,
saveNodeCoors,
}

\def\f{-2*sin(3*x/4-1/4)+2.5}

\begin{document}
% a
\begin{psgraph}{->}(0,0)(-.5,-.5)(7,5){10cm}{!}
\psplot[arrows=*-*]{1}{6}{\f}
\uput[-135](0,0){$O$}
\uput[-90](3.5,0){$A$}
\fnpnodes[plotpoints=10]{1}{6}{\f}{P}
\multido{\i=0+1}{\numexpr\Pnodecount+1}{\psline[linestyle=dashed]{<-}(P\i|0,0)(P\i)}
\uput[180](P6){$C_f$}
\psline[linecolor=red,linewidth=2\pslinewidth](P0|0,0)(P\Pnodecount|0,0)
\end{psgraph}

% b
\begin{psgraph}{->}(0,0)(-.5,-.5)(7,5){10cm}{!}
\psplot[arrows=*-*]{1}{6}{\f}
\uput[-135](0,0){$O$}
\uput[180](0,2.5){$f(A)$}
\fnpnodes[plotpoints=12]{1}{6}{\f}{P}
\multido{\i=0+1}{\numexpr\Pnodecount+1}{\psline[linestyle=dashed]{->}(P\i)(0,0|P\i)}
\uput[0](P6){$C_f$}
\psline[linecolor=red,linewidth=2\pslinewidth](0,0|P3)(0,0|P\Pnodecount)
\end{psgraph}

% c
\begin{psgraph}{->}(0,0)(-.5,-.5)(7,5){10cm}{!}
\psplot[arrows=*-*]{1}{6}{\f}
\uput[-135](0,0){$O$}
\pnode(*4 {\f}){A}
\psxTick(N-A.x){x_0}
\psyTick(N-A.y){f(x_0)}
\psCoordinates[linestyle=dashed](A)
\uput[0](A){$A(x_0,f(x_0))$}
\pcline[linestyle=dashed](A)(A|*5 {\f})\ncput[npos=1.2]{$x=x_0$}
\end{psgraph}
\end{document}