2

First of all, I must admit I have no knowledge on how to draw in LaTeX, even if I would like to have, but I have had not the opportunity to study.

I have the following picture of a projection of a vector b onto a line spanned by a:

enter image description here

But as you can see, the projection vector p is not specified in the picture, and I don't know how to do it.

Here's the code I am using:

\begin{tikzpicture}[scale=0.75]
\draw[->] (-1,0) -- (5,0);
\draw[->] (0,-1) -- (0,5);
\draw[->,thick] (0,0) -- (2,4);
\draw[->,thick] (0,0) -- (4,3);
\draw[] (1.5,3) -- (2.9,2.17);
\draw (0.8,2) node {$\ul{a}$};
\draw (2.5,1.5) node {$\ul{b}$};
\draw (2.2,2.9) node {$\ul{e}$};
\draw[yshift=73,xshift=35,scale=0.1] (2.1,3) -- (3.5,2.17);
\draw[yshift=73,xshift=53.5,scale=0.1,rotate=90] (2.1,3) -- (3.5,2.17);
\end{tikzpicture}

Also, if possible, I would like to show the line spanned by a somehow (plus a) of course...

  • 2
    (a)!(b)!(c) projects (b) onto the infinite line through (a) and (c). – user10274 Jun 7 '15 at 20:34
  • I forgot to add the $s for coordinate calculations, which requires loading the TikZ library calc with \usetikzlibrary{calc} and then use $(a)!(b)!(c)$. – user10274 Jun 7 '15 at 20:57
  • @MarcvanDongen Could you please show exactly how should I insert that code? As I said, unfortunetely, I did not have the opportunity yet to learn how to draw using tikz... – nbro Jun 7 '15 at 21:48
  • 1
    I don't want to spoil the pleasure of the learning-by-doing experience, so I'm referring you to the TikZ manual so you have the complete information. Have a look at the section entitled "Coordinate Calculations.". – user10274 Jun 8 '15 at 3:44