How can I do a simple TikZ picture of the golden ratio?

I want to make a short article explaining the origin of the Golden Number (1+sqrt(5))/2 and I need to draw a very simple segment like the picture I've uploaded. Any suggestions?

-

Two TikZ suggestions.

\documentclass[tikz,border=4mm]{standalone}
\begin{document}

\begin{tikzpicture}
\pgfmathsetmacro\gratio{(1+sqrt(5))/2}
\def\lenB{2}
\path (0,0) node[coordinate](start){} ++(\gratio*\lenB,0)node[coordinate](a){} -- ++(\lenB,0)node[coordinate](b){};

\draw (start) --node[above] {$a$} (a) --node[above]{$b$} (b);

\draw [stealth-stealth] ([yshift=-9pt]start) --node[fill=white,inner ysep=0pt]{$a+b$} ([yshift=-9pt]b);

\foreach \n in {start,a,b}
\draw (\n) ++(0,-2pt) -- ++(0,4pt);

\end{tikzpicture}
\end{document}


\documentclass[border=4mm,tikz]{standalone}

\usetikzlibrary{decorations.pathreplacing}

\begin{document}

\begin{tikzpicture}[decoration=brace]
\pgfmathsetmacro\gratio{(1+sqrt(5))/2}
\def\lenB{2}
\draw (0,0) node[coordinate](start){} -- ++(\gratio*\lenB,0)node[coordinate](a){} -- ++(\lenB,0)node[coordinate](b){};

\draw [decorate] ([yshift=-4pt]b) --node[below]{$a+b$} ([yshift=-4pt]start);
\draw [decorate] ([yshift=4pt]start) --node[above]{$a$} ([yshift=4pt]a);
\draw [decorate] ([yshift=4pt]a) --node[above]{$b$} ([yshift=4pt]b);

\foreach \n in {start,a,b}
\draw (\n) ++(0,-2pt) -- ++(0,4pt);

\end{tikzpicture}
\end{document}

-

A no-frills presentation:

\documentclass{article}
\newlength{\grlen}
% http://www.goldennumber.net/golden-section/
\def\gratio{1.61803}% Roughly
\begin{document}
$\setlength{\grlen}{50pt}% Modify this to your liking \underbrace{% \overbrace{ \makebox[0pt][l]{\rule[-1ex]{.4pt}{2.4ex}} \makebox[\gratio\grlen]{\hrulefill} \makebox[0pt][r]{\rule[-1ex]{.2pt}{2.4ex}}}^a \mkern-3mu \overbrace{ \makebox[0pt][l]{\rule[-1ex]{.2pt}{2.4ex}} \makebox[\grlen]{\hrulefill} \makebox[0pt][r]{\rule[-1ex]{.4pt}{2.4ex}}}^b }_{a+b}$
\end{document}

-

A two-dimension representation, using the golden rectangle, makes for a good visualisation of the golden ratio.

\documentclass{article}

\usepackage{tikz}

\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[scale=3]
\def\phiGR{1.618034}
\draw[thick,red,dashed] (0,0) rectangle (\phiGR,1);
\draw[thick,black,dotted] (\phiGR,0) rectangle (1,1);
\draw (0,0.5) node[left] {$$a$$};
\draw (0.5,0) node[below] {$$a$$};
\draw ({.5*(1+\phiGR)},0) node[below] {$$b$$};
\end{tikzpicture}
\end{figure}

\emph{Scale similarity} is a nice property of the golden ratio.
This property is well illustrated by a \emph{golden rectangle},
whose sides, $$a$$~and~$$a+b$$ (where~$$a>b$$), are such that
%
$\frac{a}{a+b} = \frac{b}{a} \,.$
%
The red dashed and black dotted rectangles are \emph{similar},
i.e.\ one is a scaled version of the other.
You can show (left as an exercise!) that
%
$\frac{a+b}{a} = \frac{\sqrt{5}+1}{2} \approx 1.618034 \,.$
%
That quantity is called the \emph{golden ratio} and usually denoted by~$$\phi$$.
\end{document}

-
It is 2014 please don't leave anything as exercise, either do it or don't mention it :) If you also draw the square of b you can get a chance to compare better a and b – percusse Mar 22 '14 at 10:25
@percusse "Left as an exercise" is tongue-in-cheek :) – Jubobs Mar 22 '14 at 10:35
@percusse I gave it a shot but I actually find the square of b distracting. Thanks for the suggestion, though. – Jubobs Mar 22 '14 at 19:04

\documentclass{article}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[x=5cm,y=5cm]

\Huge
\newcommand\mydistance{0.1cm}
\definecolor{myblue}{rgb}{0.067,0.529,0.871}
\definecolor{mypurple}{rgb}{0.859,0.071,0.525}
\definecolor{mygreen}{rgb}{0.255,0.431,0.027}

\node (left) {};
\node (mid) at (left.center) [xshift=5*0.61803cm] {};
\node (right) at (left.center) [xshift=5cm] {};

\node (lleft) at (left.center) [xshift=-\mydistance] {};
\node (aleft) at (left.center) [yshift=\mydistance] {};
\node (rleft) at (left.center) [xshift=\mydistance] {};
\node (bleft) at (left.center) [yshift=-\mydistance] {};

\node (lmid) at (mid.center) [xshift=-\mydistance] {};
\node (amid) at (mid.center) [yshift=\mydistance] {};
\node (rmid) at (mid.center) [xshift=\mydistance] {};
\node (bmid) at (mid.center) [yshift=-\mydistance] {};

\node (lright) at (right.center) [xshift=-\mydistance] {};
\node (aright) at (right.center) [yshift=\mydistance] {};
\node (rright) at (right.center) [xshift=\mydistance] {};
\node (bright) at (right.center) [yshift=-\mydistance] {};

\draw [ultra thick,myblue] (rleft.center) -- (aleft.center)
-- (lleft.center) -- (bleft.center) -- cycle;
\draw [ultra thick,myblue] (rleft.center) -- (lmid.center)
node [above,midway] {$$a$$};
\begin{scope}
\clip (amid.north) rectangle (bleft.south);
\draw [ultra thick,myblue] (lmid.center) -- (amid.center)
-- (rmid.center) -- (bmid.center) -- cycle;
\end{scope}
\begin{scope}
\clip (amid.north) rectangle (bright.south);
\draw [ultra thick,mypurple] (lmid.center) -- (amid.center)
-- (rmid.center) -- (bmid.center) -- cycle;
\end{scope}
\draw [ultra thick,mypurple] (rmid.center) -- (lright.center)
node [above,midway] {$$b$$};
\draw [ultra thick,mypurple] (rright.center) -- (aright.center)
-- (lright.center) -- (bright.center) -- cycle;

\path (left.center) -- (right.center)
node [midway,below,mygreen]
{\resizebox{5cm}{!}{$$\underbrace{\hspace{3cm}}$$}}
node [midway,below=0.5cm,mygreen]
{$$a+b$$}
node [midway,below=1.5cm]
{\Large\textcolor{mygreen}{$$a+b$$} is to
\textcolor{myblue}{$$a$$} as \textcolor{myblue}{$$a$$}
is to \textcolor{mypurple}{$$b$$}};

\end{tikzpicture}

\end{document}

-

It is always too short for typing exercise with PSTricks.

\documentclass[pstricks,12pt]{standalone}
\usepackage{pst-node}
\begin{document}
\begin{pspicture}[arrows=|*-|*,shortput=nab](8,2)
\pcline(1,1)(5,1)^{$a$}
\pcline(5,1)(7,1)^{$b$}
\pcline[offset=-.5]{<->}(1,1)(7,1)\ncput*{$a+b$}
\end{pspicture}
\end{document}


-