I want to draw the following diagram enter image description here

Where $BE$ is a tangent at $B$. Here is my MWE


\begin{tikzpicture}[scale=4.0, axes/.style={thick,->}]
    \draw[axes] (-1.2,0) -- (1.2,0) node[right] {$x$};
    \draw[axes] (0,-1.2) -- (0,1.2) node[above] {$y$};

    \draw (0,0) circle[radius=1];

    \draw[->] (0.2,0) node[above right]{$\theta$} arc[start angle=0, end angle=30, radius=0.2];
    \draw (0,0) -- node[below]{$\cos \theta$} ({sqrt(3)/2},0)
        -- node[right,fill=white]{\ \ $\theta$} ({sqrt(3)/2},0.5)
        -- cycle;
    \path (0,0) -- node[above]{$1$} ({sqrt(3)/2},0.5);

Edit: (Thanks to Torbjørn T.) BD an extension of OB, and is AD supposed to be vertical.

  • Is BD an extension of OB, and is AD supposed to be vertical? Oct 24, 2017 at 10:45
  • @TorbjørnT. That's right, "BD an extension of OB, and is AD supposed to be vertical." Sorry for my bad drawing. I will edit that.
    – Maryà
    Oct 24, 2017 at 10:50

4 Answers 4


A bit crude, but given the angle a, the required point E is at (1,(1-cos(a))/sin(a)) or (1,cosec(a)-cot(a))

\begin{tikzpicture}[x=4cm, y=4cm, axes/.style={thin, gray, ->},
  dot/.style={.. dot={#1:0:;}}, 
  .. dot/.style args={#1:#2:#3;}{insert path={ 
    coordinate (#1) 
    node [circle, fill, inner sep=0, minimum size=2pt,label=#2:#1]{}
\clip (-0.25, -0.25) rectangle (1.5,1.5);
\draw[axes] (-1.2,0) -- (1.2,0) node[right] {$x$};
\draw[axes] (0,-1.2) -- (0,1.2) node[above] {$y$};
  (0,0)  [dot=O:225] 
  (0:1)  [dot=A:315]
  (\a:1) [dot=B:90]  
  (0:cos \a) [dot=C:270]
  (\a:sec \a) [dot=D]
  (1, cosec \a-cot \a) [dot=E];
\draw (O) circle[radius=1];
\draw (O) -- (B) -- (C);
\draw (B) -- (D) -- (A);
\draw [dashed] (B) -- (A);
\draw [dashed] (B) -- (E);
\pic ["$\theta$", draw, ->, angle radius=1cm] {angle=C--O--B};
\path (O) -- (B) node [midway, above] {$1$};
\path (O) -- (C) node [midway, below] {$\cos\theta$};

enter image description here

  • how do you put $\theta$ on the arc in your case?
    – Maryà
    Oct 24, 2017 at 11:44
  • @marya if you mean the arc on the unit circle, I wouldn't put $\theta$ there (a) because it is too 'crowded' and with or without a white background may obscure one or more of the lines BA, BE or ED, and (b) it is unnecessary given the annotation near the origin. Oct 24, 2017 at 12:19
  • Nice point. But what if I wanted the $\theta$ on the arc. How different would it be? Could you show me?
    – Maryà
    Oct 24, 2017 at 12:25
  • @marya you could try \node [fill=white] at (\a/2:1) {$\theta$};, probably adjusting the inner sep of the node if necessary. Oct 24, 2017 at 12:51
  • Worked Perfectly. Gracias!
    – Maryà
    Oct 24, 2017 at 13:16

Also available in Metapost...

enter image description here


    path xx, yy, circle;
    pair O, A, B, C, D, E;
    numeric theta;

    xx = (6 left -- 6 right) scaled 1cm;
    yy = (1 down -- 6 up) scaled 1cm;
    circle = fullcircle scaled 10cm;

    theta = 42;

    O = origin;
    A = point 0 of circle;
    B = point theta * 8 / 360 of circle;
    C = (xpart B, 0);
    D = whatever[O,B]; D-A = whatever * up;
    E = whatever[A,D]; B-E = whatever * (B-O) rotated 90;

    drawarrow xx withpen pencircle scaled .8;
    drawarrow yy withpen pencircle scaled .8;
    draw subpath (-1/4, 17/4) of circle withcolor .67 red;

    draw E--B dashed evenly scaled 1/2 withcolor .75 blue;
    draw A--B dashed evenly scaled 1/2 withcolor .75 blue;

    draw A--D--O;
    draw C--B;

    label.rt  ("$x$", point 1 of xx);
    label.top ("$y$", point 1 of yy);

    label.llft("$\scriptstyle O$", O);
    label.lrt ("$\scriptstyle A$", A);
    label.top ("$\scriptstyle B$", B + 3 up);
    label.bot ("$\scriptstyle C$", C);
    label.top ("$\scriptstyle D$", D);
    label.rt  ("$\scriptstyle E$", E);

    label.ulft("$1$", 1/2 B);
    label.bot("$\cos\theta$", 1/2 C);

    path a; a = fullcircle scaled 42 cutafter (O--B);
    interim ahangle := 25; 
    drawarrow a withcolor .5 white;
    label.rt("$\theta$", point .5 of a);

    picture t;
    t = thelabel("$\theta$", point 1/2 theta * 8 / 360 of circle);
    unfill bbox t; draw t;



  • left, right, up, and down are defined in plain MP to be the pairs (-1,0), (1,0), (0,1), and (0,-1). So they are convenient for describing the axes, as variations on the path left -- right. I could have written: xx = (-6cm,0) -- (6cm,0); instead, but I like using the names instead of the numbers.

  • fullcircle is also defined in plain MP, to be a circle with unit diameter, so to get a circle with a 5cm radius, I have defined fullcircle scaled 10cm.

  • fullcircle is defined in plain MP to have 8 "points" starting at 3 o'clock (as it were) and going round counter clockwise, so that 12 o'clock is point 2, and 6 o'clock is point 6, and so on. The construction point theta / 8 * 360 of circle gives the point that is theta degrees counter clockwise from point 0.

  • It is always a pleasure to read your Metapost answers! One small criticism: IMHO, a beginner will have a hard time understanding point theta * 8 / 360 of circle because 8 appears to be a magic number. I think that point theta / 360 along circle is easier to understand, but that would require adding metafun as a dependency.
    – Aditya
    Oct 30, 2017 at 8:55
  • @Aditya thank you! I never can quite decide if I want to add lots of explanatory notes, or allow readers to puzzle it out for themselves. But I think that here, you are right, and I should add a note.
    – Thruston
    Oct 30, 2017 at 8:58
  • Actually, in this case B = 5cm * dir theta; might be easier!
    – Aditya
    Oct 30, 2017 at 9:06
  • True. But then we would need to make the radius a variable, to keep with the principle of orthogonality that I like to follow.
    – Thruston
    Oct 30, 2017 at 9:11

Asymptote MWE:

// theta.asy
// To get theta.pdf, run 
// asy theta.asy

import graph;
import fontsize;defaultpen(fontsize(9pt));

real w=0.5bp;
pen linePen=darkblue+w;
pen arcPen=orange+w;
pen markPen=gray(0.3)+w;
pen axisPen=gray(0.3)+w;
pen dashPen=gray(0.3)+w+linetype(new real[]{5,5})+squarecap;
arrowbar arr=Arrow(HookHead,size=2);


real R=1,theta=42;
pair O,A,B,C,D,E;

guide gc=Arc(O,R,-4,94);
A=(R,0); B=rotate(theta)*A; C=(B.x,0);

pair[] p={O,A,B,C,D,E};
string[] lab={"O","A","B","C","D","E"};
pair[] dp={plain.SW,plain.SW,plain.N,plain.S,plain.N,plain.E,};
for(int i=0;i<p.length;++i){


enter image description here


The point D is at (R,R*tan(theta)), E is found by the help of the intersections library. I modified some other things as well, such as declaring constants used for angle and radius, and drawing the various elements based on those. There are a now some comments in the code.

output of code

%  scale=4.0,
  declare function={
    % define functions/constants for angle and radius
  % reduce font size for labels
  every label/.append style={font=\scriptsize}
    % addition: base axes length on radius
    \draw[axes] (-1.2*R,0) -- (1.2*R,0) node[right] {$x$};
    \draw[axes] (0,-1.2*R) -- (0,1.2*R) node[above] {$y$};

    % addition: add named coordinate with label in origin
    % use constant defined above for radius
    \draw (0,0) coordinate[label=below left:$O$] (O) circle[radius=R];

    % addition: start point of arc relative to radius
    \draw[->] (0.2*R,0) node[above right]{$\theta$} arc[start angle=0, end angle=theta, radius=0.2*R];

    % additions;
    %  - named coordinates with labels in B and C
    %  - moved drawing of "1" node to this path (no need for a second one I think)
    \draw (O) -- node[below]{$\cos \theta$} ({R*cos(theta)},0) coordinate [label=below:$C$] (C)
        -- ({R*cos(theta)},{R*sin(theta)}) coordinate[label=above:$B$] (B)
        -- node[above]{$1$} cycle;

    % new path, drawing from A via D to B
    % name this path A, to use later
    \draw [name path=A] (R,0) coordinate[label=below right:$A$] (A)
        -- (R,{R*tan(theta)}) coordinate [label=above right:$D$] (D)
        -- (B);

    % path that doesn't influence bounding box (overlay option)
    % starting at B, using polar coordinates to make the path tangent
    % to the circle
    % name path B to use below
    \path[overlay,name path=B] (B) -- ++(theta-90:R);

    % calculate intersections of ADB path and the invisible path, name the first
    % intersection E. draw dasdhed line from B to E
    \draw [name intersections={of=A and B,by={E,}},dashed] (B) -- (E) node[right,font=\scriptsize] {$E$};

    \draw [dashed] (B) -- (A);

    % alternative way of placing second theta-node, saves manual adjustment
    % relative to the line BC
    \path (A) arc[start angle=0,end angle=theta/2,radius=R] node[inner sep=1pt,fill=white]{$\theta$};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.