\documentclass{article}

\usepackage{mathtools}
\usepackage{amssymb}

\usepackage{pgfplots}
\usepgfplotslibrary{external}
\tikzexternalize
\tikzset{%
    external/system call={pdflatex \tikzexternalcheckshellescape --halt-on-error --interaction=batchmode --output-directory=./build --jobname "\image" "\texsource"},
    /pgf/images/include external/.code={%
        \includegraphics{build/#1}%
    },
}

\title{Analyse 1 - TD 1 \\ NON CORRIGÉ}
\author{Timéo Pochin}

\begin{document}
    \maketitle

    \section*{Exercice 1}

    \subsection*{a)}
    \begin{align}
              & 5x+2\geq-3 \nonumber \\
    \iff\quad & 5x\geq-5 \nonumber \\
    \iff\quad & x\geq-1 \nonumber \\
    \iff\quad & x=\left[-1,+\infty\right[ \nonumber
    \end{align}

    \subsection*{b)}
    \begin{align}
              & 2x-1<4x+3\leq-x+6 \nonumber \\
    \iff\quad & (2x-1<4x+3)\land(4x+3\leq-x+6) \nonumber \\
    \iff\quad & (-4<2x)\land(5x\leq 3) \nonumber \\
    \iff\quad & (-2<x)\land(x\leq\frac{3}{5}) \nonumber \\
    \iff\quad & x=\left]-2,\frac{3}{5}\right] \nonumber
    \end{align}

    \subsection*{c)}
    \begin{align}
              & |x-1|<4 \nonumber \\
    \iff\quad & (x-1<4)\land(x-1>-4) \nonumber \\
    \iff\quad & (x<5)\land(x>-3) \nonumber \\
    \iff\quad & x=\left]-3,5\right[ \nonumber
    \end{align}

    \subsection*{d)}
    \begin{align}
              & |x-2|\geq 3 \nonumber \\
    \iff\quad & (x-2\geq 3)\lor(x-2\leq-3) \nonumber \\
    \iff\quad & (x\geq 5)\lor(x\leq-1) \nonumber \\
    \iff\quad & x=\left]-\infty,-1\right]\ \cup\ \left[5,+\infty\right[ \nonumber
    \end{align}

    \subsection*{e)}
    \begin{align}
              & |x-2|\leq|x| \nonumber \\
    \iff\quad & (x-2)^2\leq x^2 \nonumber \\
    \iff\quad & x^2-4x+4\leq x^2 \nonumber \\
    \iff\quad & 4\leq 4x \nonumber \\
    \iff\quad & 1\leq x \nonumber \\
    \iff\quad & x=\left[1,+\infty\right[ \nonumber
    \end{align}

    \subsection*{f)}

    \subsection*{g)}
    \begin{align}
              & \sqrt{x+1}<2 \nonumber \\
    \iff\quad & (x+1<4)\land(x+1\geq0) \nonumber \\
    \iff\quad & (x<3)\land(x\geq-1) \nonumber \\
    \iff\quad & x=\left[-1,3\right[ \nonumber
    \end{align}

    \subsection*{h)}
    \begin{align}
              & x^2+1\leq 3 \nonumber \\
    \iff\quad & x^2\leq 2 \nonumber \\
    \iff\quad & (x\leq\sqrt{2})\land(x\geq-\sqrt{2}) \nonumber \\
    \iff\quad & x=\left[-\sqrt{2},\sqrt{2}\right] \nonumber
    \end{align}

    \subsection*{i)}
    \begin{align}
              & x^2+3x<4 \nonumber \\
    \iff\quad & x^2+3x-4<0 \nonumber \\
    \iff\quad & (x-1)(x+4)<0 \nonumber \\
    \iff\quad & (x<1)\land(x>-4) \nonumber \\
    \iff\quad & x=\left]-4,1\right[ \nonumber
    \end{align}

    \subsection*{j)}
    \begin{align}
              & x^3-3x^2+2x\geq 0 \nonumber \\
    \iff\quad & x(x^2-3x+2)\geq 0 \nonumber \\
    \iff\quad & x(x-1)(x-2)\geq 0 \nonumber \\
    \iff\quad & \big((x\geq 0)\land(x\leq 1)\big)\lor(x\geq 2) \nonumber \\
    \iff\quad & x=\left[0,1\right]\cup\left[2,+\infty\right[ \nonumber
    \end{align}

    \subsection*{k)}

    \section*{Exercice 2}

    \[
    f:x\mapsto ax+b
    \]

    \begin{align}
                  & \big(|f(-1)|=3\big)\land\big(|f(2)=2|\big) \nonumber \\
        \iff\quad & (|b-a|=3)\land(|2a+b|=2) \nonumber \\
        \iff\quad & (b-a=3\lor b-a=-3)\land(2a+b=2\lor 2a+b=-2) \nonumber \\
        \iff\quad & (b-a=3\land 2a+b=2) \nonumber \\
             \lor & (b-a=3\land 2a+b=-2) \nonumber \\
             \lor & (b-a=-3\land 2a+b=2) \nonumber \\
             \lor & (b-a=-3\land 2a+b=-2) \nonumber
    \end{align}

    \begin{align}
                  & b-a=3\land 2a+b=2 \nonumber \\
        \iff\quad & 3a=-1\land 3b=8 \nonumber \\
        \iff\quad & a=-\frac{1}{3}\land b=\frac{8}{3} \nonumber
    \end{align}
    \begin{align}
                  & b-a=3\land 2a+b=-2 \nonumber \\
        \iff\quad & 3a=-5\land 3b=4 \nonumber \\
        \iff\quad & a=-\frac{5}{3}\land b=\frac{4}{3} \nonumber
    \end{align}
    \begin{align}
                  & b-a=-3\land 2a+b=2 \nonumber \\
        \iff\quad & 3a=5\land 3b=-4 \nonumber \\
        \iff\quad & a=\frac{5}{3}\land b=-\frac{4}{3} \nonumber
    \end{align}
    \begin{align}
                  & b-a=-3\land 2a+b=-2 \nonumber \\
        \iff\quad & 3a=1\land 3b=-8 \nonumber \\
        \iff\quad & a=\frac{1}{3}\land b=-\frac{8}{3} \nonumber
    \end{align}

    Donc

    \[
    (a,b)\in
    \left\{
        \left(-\frac{1}{3},\frac{8}{3}\right),
        \left(-\frac{5}{3},\frac{4}{3}\right),
        \left(\frac{5}{3},-\frac{4}{3}\right),
        \left(\frac{1}{3},-\frac{8}{3}\right)
    \right\}
    \]

    \begin{tikzpicture}
        \begin{axis}[
            xmin = -4.9, xmax = 4.9,
            ymin = -4.9, ymax = 4.9,
            axis x line = middle,
            axis y line = middle,
            xtick distance = 1,
            ytick distance = 1,
            grid = both,
            minor tick num = 5,
            major grid style = {lightgray},
            minor grid style = {lightgray!25},
            width = \textwidth,
            height = \textwidth,
        ]
        \addplot[
            color = black
        ]{-(1/3)*x+(8/3)} node[above right,pos=0.83] {$-\frac{1}{3}x+\frac{8}{3}$};
        \addplot[
            color = black
        ]{-(5/3)*x+(4/3)} node[above right,pos=0.85] {$-\frac{5}{3}x+\frac{4}{3}$};
        \addplot[
            color = black
        ]{(1/3)*x-(8/3)} node[above left,pos=0.95] {$\frac{1}{3}x-\frac{8}{3}$};
        \addplot[
            color = black
        ]{(5/3)*x-(4/3)} node[above left,pos=0.8] {$\frac{5}{3}x-\frac{4}{3}$};
        \end{axis}
    \end{tikzpicture}

    \section*{Exercice 3}

    \subsection*{a)}
    \begin{tikzpicture}
        \begin{axis}[
            xmin = -4.9, xmax = 4.9,
            ymin = -0.9, ymax = 8.9,
            axis x line = middle,
            axis y line = middle,
            xtick distance = 1,
            ytick distance = 1,
            grid = both,
            minor tick num = 5,
            major grid style = {lightgray},
            minor grid style = {lightgray!25},
            width = \textwidth/3*2,
            height = \textwidth/3*2,
        ]
        \addplot[
            thick,
            color = black,
            samples = 1000
        ]{abs(x)+abs(2*x-4)};
        \addplot[
            ultra thin,
            color = red,
            samples = 1000
        ]{abs(x)};
        \addplot[
            ultra thin,
            color = blue,
            samples = 1000
        ]{abs(2*x-4)};
        \end{axis}
    \end{tikzpicture}

    \subsection*{b)}
    L’ensemble $f(\mathbb{R})$ est égal à $\left[2,+\infty\right[$.
    %
    \\
    La fonction $f$ est minorée et elle n’est pas majorée.

    \subsection*{c)}
    Les antécédents par $f$ de $3$ sont $1$ et $\frac{7}{3}$.
    \\
    $1$ n’a pas d’antécédents par $f$.
    \\
    L’antécédent par $f$ de $2$ est $2$.

    \section*{Exercice 4}

    \subsection*{a)}
    \subsubsection*{i)}
    \begin{tikzpicture}
        \begin{axis}[
            xmin = -3.5, xmax = 3.5,
            ymin = -3.5, ymax = 3.5,
            axis x line = middle,
            axis y line = middle,
            xtick distance = 1,
            ytick distance = 1,
            grid = both,
            minor tick num = 5,
            major grid style = {lightgray},
            minor grid style = {lightgray!25},
            width = \textwidth/3*2,
            height = \textwidth/3*2,
        ]
        \addplot[
            thick,
            smooth,
            color = red,
            samples = 100
        ][
            domain=-1:2
        ]{0.5*x^2-x-1};
        \addplot[
            smooth,
            color = black,
            samples = 100
        ][
            domain=-1:2
        ]{-(0.5*x^2-x-1)};
        \end{axis}
    \end{tikzpicture}

    \subsubsection*{ii)}
    \begin{tikzpicture}
        \begin{axis}[
            xmin = -3.5, xmax = 3.5,
            ymin = -3.5, ymax = 3.5,
            axis x line = middle,
            axis y line = middle,
            xtick distance = 1,
            ytick distance = 1,
            grid = both,
            minor tick num = 5,
            major grid style = {lightgray},
            minor grid style = {lightgray!25},
            width = \textwidth/3*2,
            height = \textwidth/3*2,
        ]
        \addplot[
            thick,
            smooth,
            color = red,
            samples = 100
        ][
            domain=-1:2
        ]{0.5*x^2-x-1};
        \addplot[
            smooth,
            color = black,
            samples = 100
        ][
            domain=-2:1
        ]{0.5*(-x)^2-(-x)-1};

        \end{axis}
    \end{tikzpicture}

    \subsubsection*{iii)}
    \begin{tikzpicture}
        \begin{axis}[
            xmin = -3.5, xmax = 3.5,
            ymin = -3.5, ymax = 3.5,
            axis x line = middle,
            axis y line = middle,
            xtick distance = 1,
            ytick distance = 1,
            grid = both,
            minor tick num = 5,
            major grid style = {lightgray},
            minor grid style = {lightgray!25},
            width = \textwidth/3*2,
            height = \textwidth/3*2,
        ]
        \addplot[
            thick,
            smooth,
            color = red,
            samples = 100
        ][
            domain=-1:2
        ]{0.5*x^2-x-1};
        \addplot[
            smooth,
            color = black,
            samples = 100
        ][
            domain=-1:2
        ]{0.5*x^2-x+1};
        \end{axis}
    \end{tikzpicture}

    \subsubsection*{iv)}
    \begin{tikzpicture}
        \begin{axis}[
            xmin = -3.5, xmax = 3.5,
            ymin = -3.5, ymax = 3.5,
            axis x line = middle,
            axis y line = middle,
            xtick distance = 1,
            ytick distance = 1,
            grid = both,
            minor tick num = 5,
            major grid style = {lightgray},
            minor grid style = {lightgray!25},
            width = \textwidth/3*2,
            height = \textwidth/3*2,
        ]
        \addplot[
            thick,
            smooth,
            color = red,
            samples = 100
        ][
            domain=-1:2
        ]{0.5*x^2-x-1};
        \addplot[
            smooth,
            color = black,
            samples = 100
        ][
            domain=-3:0
        ]{0.5*(x+2)^2-(x+2)-1};
        \end{axis}
    \end{tikzpicture}

\end{document}
