I'm doing an exercise of integral calculus. The integral is $\int \dfrac{dx}{4-x^2}$. This integral can be solved doing $x = 2\sin\,\alpha$, and its solution is $\dfrac{1}{2}\ln\,|\sec\,\alpha + \tan\,\alpha|+C$. I need to draw a rectangle triangle to avoid doing all the tedious maths, trying to find $\sec\,\alpha$ and $\tan\,\alpha$ in terms of $x$. In the image is what I'm trying to draw.


  • 1
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – henry
    Mar 27, 2015 at 20:50
  • You shouldn't use \, at all in that code. The thin spaces are added automatically by TeX.
    – Manuel
    Mar 27, 2015 at 23:47
  • It's just costume Manuel, but I appreciate your advice
    – Alexei0709
    Mar 28, 2015 at 0:28

6 Answers 6


With tkz-euclide:

\tkzInit[xmax=5,ymax=3] %\tkzClip[space=.5]
\tkzDefPoint(0,0){A} \tkzDefPoint(4,0){B}
\tkzLabelSegment[below,font=\footnotesize](A,B){$\sqrt{4 - x^2}$}
\tkzMarkAngle[fill= blue!40,size=1.4cm,opacity=.5](B,A,C)

enter image description here


An attempt with MetaPost, in LuaLaTeX.

Given a real x (supposed to be greater than 0 and lower than 2), it uses the Pythagorean subtraction (built in MetaPost) to compute the length of the other side adjacent to the angle.

        numeric u; u = 2.5cm;
            x = 1; y = 2 +-+ x; % Pythagorean subtraction
            pair A, B, C; A = origin; B = (u*y, 0); C = (0, u*x);
            label.bot("$\sqrt{4-x^2}$", .5[A,B]);
            label.lft("$x$", .5[A,C]);
            label.urt("$2$", .5[B,C]);
            draw ((1, 0) -- (1, 1) -- (0, 1)) scaled 2mm; % mark right angle
            path angle_mark; 
            angle_mark = anglebetween(B--A, B--C, "\alpha"); % angle \alpha
            fill B -- angle_mark -- cycle withcolor .8white;
            draw A -- B -- C -- cycle;
            draw angle_mark; 

Output with x = 1:

enter image description here

With x = 0.5:

enter image description here

With x = 1.5:

enter image description here


Here is a TikZ version:


    \draw(0,0)--node[below]{$\sqrt{4-x^2}$} (1.7,0)
    \draw[very thin,<->](1.4,0) arc [start angle=180,end angle=150, radius=0.3];
    \node at (1.3,0.1){$\alpha$};




Andrew's solution, but a bit more symbolic

  \coordinate (A) at (0,0);
  \coordinate (B) at (0,1);
  \coordinate (C) at (1.7,0);
  \draw (A) -- node[auto] {$x$}
        (B) -- node[auto] {$2$}
        (C) -- node[auto] {$\sqrt{4 - x^2}$}
  \draw pic[draw,<->,angle radius=1cm,pic text=$\alpha$,angle eccentricity=1.2] {angle = B--C--A};

If you want to consider using pstricks, this is a short code for your figure:



\psset{shortput=nab, arrows=c-c, linearc = 0.005}%
\begin{psmatrix}[colsep=3.8cm, rowsep=1.8cm]
    [name = A]\\
    [name = B] & [name = C]


enter image description here

  • --> \sqrt. Mar 28, 2015 at 20:43
  • 1
    Once more, I forgot tocheck what my editor displays! Thanks for pointing it.
    – Bernard
    Mar 29, 2015 at 3:01

A PSTricks solution:



%%% parameters
% 0 < \side < 2
% \scale > 0


\begin{pspicture}[unit = \scale]%
  \pstMarkAngle[MarkAngleRadius = 0.2, LabelSep = 0.3]{P2}{P3}{P1}{$\alpha$}
  \pstRightAngle[RightAngleSize = 0.1]{P3}{P1}{P2}
  \psset{linestyle = none, offset = 7pt}
  \pcline[offset = 9pt](P3)(P1)
  \ncput{$\sqrt{4 - x^{2}}$}



All you have to do is change the values of the parameters and the drawing will be adjusted accordingly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .