[Tex/LaTex] Beginner: Drawing using Tikz


I was quite impressed by the figures generated by TikZ and wanted to try TikZ to generate a few figures (please see the attached image drawn using an external WYSWYG program). When I tried to reproduce the figures myself using TikZ I found it very difficult to control the shapes in required positions. What is the simplest method to draw!these figures using TikZ?

enter image description here

Best Answer

With next code you can obtain first example. All others can be easily done after reading first tutorial in TiKZ documentation (pgfmanual).

\draw [->] (-1.5,0)--(3,0);
\draw [->] (0,-1.5)--(0,3);
\draw[dashed] (-1,0)--(0,1)--(1,0)--(0,-1)--cycle;
\node[below left] at (0,0) {$x$};
\draw[shorten <=-1cm, shorten >=-3mm] (0,1)--(2,0) node [midway, above] {$A$};
\node[above right] at (0,1) {$\hat{x}$};

enter image description here