\documentclass[12pt,a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage{kpfonts}
\usepackage{pas-math}
\usepackage{tkz-euclide}
\usetikzlibrary{matrix,arrows}
\usepackage[margin=2cm]{geometry}
\usepackage{titlesec}
\usepackage{fancyhdr}
\usepackage{eso-pic}
\usepackage{enumitem}
\usepackage[urlcolor=purple,colorlinks=true]{hyperref}
\definecolor{violet}{cmyk}{0.28,0.89,0,0.28}
\definecolor{vert}{cmyk}{0.17,0,0.17,0.07}
\newcommand{\chapHead}[1]{% #1 = Titre
\begin{tikzpicture}
\fill[blue!20] (0,0) rectangle+(\textwidth,-1.5cm);
\fill[orange!5] (0,-1) rectangle +(\textwidth,-5cm);
\fill[violet] (12cm,0) rectangle +(4cm,-4.5cm);
\fill[violet!80] (12cm,-4.5cm) rectangle+(0.5cm,0.5cm);
\fill[violet!70] (12.5cm,-4.5cm) rectangle+(0.5cm,0.5cm);
\fill[violet!60] (13cm,-4.5cm) rectangle+(0.5cm,0.5cm);
\fill[violet!60] (12cm,-4cm) rectangle+(0.5cm,0.5cm);
\fill[violet!50] (12.5cm,-4cm) rectangle+(0.5cm,0.5cm);
\fill[violet!40] (12cm,-3.5cm) rectangle+(0.5cm,0.5cm);
\fill[violet!40] (13.5cm,-4.5cm) rectangle+(0.5cm,0.5cm);
\fill[vert] (12cm,-4.5cm) rectangle +(4cm,-1.5cm);
% "Article"
\node[below] at (14cm,-0.5cm) {%
\begin{minipage}{4cm}
\begin{center}
\color{white}\fontfamily{lmss}\fontseries{bx}\selectfont{\Large Article}

\bigskip

\emph{par\\{\small Stéphane PASQUET}}
\end{center}
\end{minipage}
};
% Titre
\node[below right] (titre) at (0.25cm,-1.5cm) {%
\begin{minipage}{11cm}
\fontfamily{lmss}\fontseries{bx}\selectfont\color{purple}\Huge #1
\end{minipage}
};
\node[below right,text=purple] at ($(titre.south west)+(0,-1em)$) {\fontfamily{lmss}\fontshape{it}\selectfont Disponible sur \url{http://www.mathweb.fr}};
% Date
\node at (14cm,-5.5cm) {%
\begin{minipage}{4cm}
\begin{center}
\fontfamily{lmss}\fontseries{bx}\selectfont\color{black}\today
\end{center}
\end{minipage}
};
\end{tikzpicture}
}
% Sections
\titleformat{\section}[block]
{\fontfamily{lmss}\fontseries{bx}\fontsize{16}{14}\selectfont\color{violet}}
{\thesection}
{1em}
{\fontfamily{lmss}\fontseries{bx}\selectfont}
\setlength{\parindent}{0pt}

% Paragraph

\titleformat{\paragraph}[runin]
{\fontfamily{lmss}\fontseries{b}\selectfont\color{purple}}{\theparagraph}{1em}{}
% Enoncé

\newsavebox{\PASboxEnonce}

\newenvironment{enonce}
{%
\begin{lrbox}{\PASboxEnonce}
\fontfamily{lmss}
\fontshape{it}
\selectfont
}
{%
\end{lrbox}
\begin{tikzpicture}
\tikzstyle{degrade} = [rectangle,inner sep=10pt,fill=violet!30,path fading=east]
\node[degrade] {\begin{minipage}{\linewidth}\usebox{\PASboxEnonce}\end{minipage}};
\end{tikzpicture}
}

% Itemize

\setlist[itemize,1]{label={\color{purple}\textbullet}}

% footpage

\cfoot{\fontfamily{lmss}\fontseries{bx}\selectfont\color{white}\fcolorbox{violet}{violet}{\thepage}}

\renewcommand{\headrulewidth}{0pt}
\newcommand{\sgn}[1]{\text{sgn}(#1)}
\newcommand{\red}[1]{\textcolor{red}{#1}}
\newcommand{\blue}[1]{\textcolor{blue}{#1}}
\newenvironment{cadrecode}{%
  \def\FrameCommand{{\color[HTML]{888888}\vrule width 3pt}\colorbox{gray!10}}%
  \MakeFramed {\advance\hsize-\width \FrameRestore}}%
{\endMakeFramed}

\begin{document}
\pagestyle{fancy}
\chapHead{Le théorème de Viviani}


\section*{\'Enoncé}

\emph{Dans un triangle équilatéral, la somme des distances d'un point intérieur quelconque aux trois côtés est constante.}
\begin{center}
\begin{tikzpicture}
\tkzInit[xmin=-1,ymin=-1,xmax=6,ymax=6]
\tkzClip
\tkzDefPoint(0,0){A}
\tkzDefPoint(60:5){B}
\tkzDefPoint(5,0){C}
\tkzDefBarycentricPoint(A=1,B=2,C=3) \tkzGetPoint{M}
\tkzDrawPoints(M)
\tkzLabelPoints[above](M)
\draw (0,0) node[below left] {A} -- (60:5) node[above] {B} -- (5,0) node[below right] {C} -- cycle;
\tkzDefLine[perpendicular=through M](A,B)\tkzGetPoint{N}
\tkzInterLL(M,N)(A,B)\tkzGetPoint{O}
\draw[dashed] (O) -- (M);
%
\tkzDefLine[perpendicular=through M](A,C)\tkzGetPoint{P}
\tkzInterLL(M,P)(A,C)\tkzGetPoint{Q}
\draw[dashed] (Q) -- (M);
%
\tkzDefLine[perpendicular=through M](C,B)\tkzGetPoint{R}
\tkzInterLL(M,R)(C,B)\tkzGetPoint{S}
\draw[dashed] (S) -- (M);
\tkzLabelPoints[below](Q)
\tkzLabelPoints[right](S)
\tkzLabelPoints[left](O)
\end{tikzpicture}
\end{center}
Autrement dit, quelle que soit la position du point M dans le triangle ABC, \[ \text{MS}+\text{MQ}+\text{MO} = \text{constante}\]

\newpage

\AddToShipoutPictureBG
{%
	\put(0,\LenToUnit{\dimexpr\paperheight-2cm})
	{%
		\begin{tikzpicture}
		\begin{scope}[rotate=-90]
		\fill[violet!80] (12cm,-4.5cm) rectangle+(0.5cm,0.5cm);
\fill[violet!70] (12.5cm,-4.5cm) rectangle+(0.5cm,0.5cm);
\fill[violet!60] (13cm,-4.5cm) rectangle+(0.5cm,0.5cm);
\fill[violet!60] (12cm,-4cm) rectangle+(0.5cm,0.5cm);
\fill[violet!50] (12.5cm,-4cm) rectangle+(0.5cm,0.5cm);
\fill[violet!40] (12cm,-3.5cm) rectangle+(0.5cm,0.5cm);
\fill[violet!40] (13.5cm,-4.5cm) rectangle+(0.5cm,0.5cm);
		\end{scope}
		\end{tikzpicture}
	}
	\put(\LenToUnit{\dimexpr\paperwidth-1.5cm},0)
	{%
		\begin{tikzpicture}
		\begin{scope}[rotate=90]
		\fill[violet!80] (12cm,-4.5cm) rectangle+(0.5cm,0.5cm);
\fill[violet!70] (12.5cm,-4.5cm) rectangle+(0.5cm,0.5cm);
\fill[violet!60] (13cm,-4.5cm) rectangle+(0.5cm,0.5cm);
\fill[violet!60] (12cm,-4cm) rectangle+(0.5cm,0.5cm);
\fill[violet!50] (12.5cm,-4cm) rectangle+(0.5cm,0.5cm);
\fill[violet!40] (12cm,-3.5cm) rectangle+(0.5cm,0.5cm);
\fill[violet!40] (13.5cm,-4.5cm) rectangle+(0.5cm,0.5cm);
		\end{scope}
		\end{tikzpicture}
	}
}

\section*{Démonstration avec les aires}

\begin{center}
\begin{tikzpicture}
\tkzInit[xmin=-1,ymin=-1,xmax=6,ymax=6]
\tkzClip
\tkzDefPoint(0,0){A}
\tkzDefPoint(60:5){B}
\tkzDefPoint(5,0){C}
\tkzDefBarycentricPoint(A=1,B=2,C=3) \tkzGetPoint{M}
\filldraw[fill=violet!10] (A) -- (B) -- (M) -- cycle;
\filldraw[fill=purple!20] (A) -- (C) -- (M) -- cycle;
\filldraw[fill=vert!40] (C) -- (B) -- (M) -- cycle;
\tkzDrawPoints(M)
\tkzLabelPoints[above](M)
\draw (0,0) node[below left] {A} -- (60:5) node[above] {B} -- (5,0) node[below right] {C} -- cycle;
\tkzDefLine[perpendicular=through M](A,B)\tkzGetPoint{N}
\tkzInterLL(M,N)(A,B)\tkzGetPoint{O}
\draw[dashed] (O) -- (M);
%
\tkzDefLine[perpendicular=through M](A,C)\tkzGetPoint{P}
\tkzInterLL(M,P)(A,C)\tkzGetPoint{Q}
\draw[dashed] (Q) -- (M);
%
\tkzDefLine[perpendicular=through M](C,B)\tkzGetPoint{R}
\tkzInterLL(M,R)(C,B)\tkzGetPoint{S}
\draw[dashed] (S) -- (M);
\tkzLabelPoints[below](Q)
\tkzLabelPoints[right](S)
\tkzLabelPoints[left](O)
\end{tikzpicture}
\end{center}
Posons $A_1$ l'aire du triangle ABM ; alors,
\[ A_1=\frac{1}{2}\text{AB}\times\text{MO}.\]
Posons $A_2$ l'aire du triangle ACM ; alors,
\[ A_2=\frac{1}{2}\text{AC}\times\text{MQ}.\]
Posons $A_3$ l'aire du triangle CBM ; alors,
\[ A_3=\frac{1}{2}\text{BC}\times\text{MS}.\]
Posons $A_0$ l'aire du triangle ABC ; alors,
\[ A_0=\frac{1}{2}\text{AC}\times h\]
où $h$ est la hauteur de ABC issue de B. \`A l'aide du théorème de Pythagore, on peut démontrer que :
\[ h = \frac{\sqrt{3}}{2}\text{AC}.\]
On en déduit que :
\[ A_0=\frac{\sqrt{3}}{4}\text{AC}^2.\]
Or, 
\[ A_0=A_1+A_2+A_3\]
et
\[ \text{AC} = \text{AB} = \text{BC}. \]
Donc :
\[ \frac{\sqrt{3}}{4}\text{AC}^2=\frac{1}{2}\text{AC}\left(\text{MO}+\text{MS}+\text{MQ}\right) \]
soit :
\[ \boxed{\text{MO}+\text{MS}+\text{MQ} = \frac{\sqrt{3}}{2}\text{AC}}.\]

\medskip

On voit alors que la somme des 3 distances ne dépend pas de la position de M.

\section*{Démonstration avec l'analyse}

On rapporte le plan au repère $\left(\text{A}~;\vv{\text{AC}},\vv{j}\right)$, où $\vv{\text{AC}}\cdot\vv{j}=0$ et $\|\vv{\text{AC}}\|=\|\vv{j}\|$. Alors,
\[ \text{A}(0~;0)\quad ;\quad \text{C}(1~;0)\quad ;\quad \text{B}\left(\frac{1}{2}~;\frac{\sqrt{3}}{2}\right).\]
Ainsi,
\[ \vv{\text{AB}}\left(\begin{array}{c}\frac{1}{2}\\ \frac{\sqrt{3}}{2}\end{array}\right),\]
d'où :
\[ (\text{AB})\;:\; \frac{\sqrt{3}}{2}x-\frac{1}{2}y=0,\]
ou encore :
\[ (\text{AB})\;:\; \sqrt{3}x-y=0.\]
De plus, on a :
\[ \vv{\text{BC}}\left(\begin{array}{c}\frac{1}{2}\\-\frac{\sqrt{3}}{2}\end{array} \right) ,\]
d'où :
\[ (\text{BC})\;:\; -\sqrt{3}x-y+y_0=0.\]
\[\text{C}\in(\text{BC}) \Rightarrow y_0=\sqrt{3},\]
donc :
\[ (\text{BC})\;:\; -\sqrt{3}x-y+\sqrt{3}=0\]
Posons alors M($\alpha~;\beta$) dans ce repère. On sait que la distance du point M à une droite $(d)$ d'équation $ax+by+c=0$ est :
\[ \text{d}(\text{M};(d))=\frac{\vert a\alpha + b\beta + c\vert}{\sqrt{a^2+b^2}}. \]
D'où :
\[ \text{d}(\text{M};(\text{AB}))=\frac{\vert \alpha\sqrt{3} - \beta \vert}{\sqrt{\sqrt{3}^2+(-1)^2}}=\frac{\vert \alpha\sqrt{3}-\beta\vert}{2} \]
et
\[ \text{d}(\text{M};(\text{BC}))=\frac{\vert -\alpha\sqrt{3} - \beta+\sqrt{3} \vert}{\sqrt{(-\sqrt{3}^2+(-1)^2}}=\frac{\vert -\alpha\sqrt{3} - \beta+\sqrt{3}\vert}{2}. \]
De plus,
\[ \text{d}(\text{M};(\text{AC}))=\beta.\]
De plus, M est toujours au-dessous de (AB), d'équation réduite :
\[ y=x\sqrt{3}.\]
Donc :
\[ \beta \leqslant \alpha\sqrt{3},\]
ce qui signifie que :
\[ \alpha\sqrt{3}-\beta\geqslant 0,\]
et donc :
\[ \text{d}(\text{M};(\text{AB}))=\frac{\alpha\sqrt{3}-\beta}{2}. \]
De même, M est toujours au-dessous de (BC), d'équation réduite :
\[ y=-x\sqrt{3}+\sqrt{3},\]
d'où :
\[ \beta\leqslant-\alpha\sqrt{3}+\sqrt{3},\]
ce qui signifie que :
\[ -\alpha\sqrt{3}-\beta+\sqrt{3}\geqslant 0\]
et donc :
\[ \text{d}(\text{M};(\text{BC}))=\frac{-\alpha\sqrt{3} - \beta+\sqrt{3}}{2}. \]
Ainsi,
\[ \text{d}(\text{M};(\text{BC})) + \text{d}(\text{M};(\text{AC})) + \text{d}(\text{M};(\text{AB}))=\frac{\alpha\sqrt{3}-\beta-\alpha\sqrt{3}-\beta+\sqrt{3}}{2}+\beta,\]
soit :
\[ \boxed{\text{d}(\text{M};(\text{BC})) + \text{d}(\text{M};(\text{AC})) + \text{d}(\text{M};(\text{AB}))=\frac{\sqrt{3}}{2}}.\]

\medskip

La somme des 3 distances ne dépend donc pas de la position du point M.
\end{document}