TransWikia.com

Drawing a triangle, with angles inside, inside a circle and other details

TeX - LaTeX Asked on November 26, 2020

I am trying to draw a figure similar to this one enter image description here

This is the code for that figure that I’ve done so far

documentclass{article}
usepackage[utf8]{inputenc}

usepackage{tikz}
usepackage{graphicx}
usepackage{amsmath}
usepackage{amssymb}
usepackage{xcolor}

begin{document}

begin{tikzpicture}
    %coordinate system
    draw[thick,->] (0,-5) -- (0,5)node[above left]{$y$};
    draw[thick,->] (-5,0) -- (5,0)node[below right]{$x$};
    
%circle
draw (4,0) arc (0:360:4)node[ below]{$ $};

%dots % their lines
draw[red] (0,0) -- (2.8,2.9)  node[circle,red,fill,inner sep=3pt]{} node[above right]{$Q=(cos v,sin v)$};

draw[blue] (0,0) -- (-2.8,2.9)  node[circle,blue,fill,inner sep=3pt]{} node[above left]{$P=(cos u,sin u)$};

%line joining both dots
draw[magenta] (-2.8,2.9) -- (2.8,2.9) node[midway, above left ]{$d$};

%angles
draw (2,0) arc (0:134:2)node[midway,above right]{$u $};

draw (1,0) arc (0:45:1)node[midway,above right]{$v $};

end{tikzpicture}

end{document}

How can I draw the arrows for the direction of the angles?

And also how can I add the label for the circle, it’s supposed to be a unit circle, I wanted to draw an arrow indicating that the equation $x^2+y^2=1$ is that circle.

Could someone please help?

Thank you in advance.

Edit.

The label for the circle without arrow:
%circle
draw (4,0) arc (0:360:4)node[very near end, below right]{$x^2+y^2=1$};

Edit2.

So far, the image is this, which looks decent 🙂 I think.

enter image description here

One Answer

Arrow tips for arcs are added the same way as arrow tips to other paths, so do exactly the same as you did for the axes: [->]

For the equation: add the node with e.g. node (eq) at (x,y) {...}; with suitable values for x and y, or node (eq) at (angle:radius) {...}; to use polar coordinates instead of Cartesian coordinates. Having named the node eq, you can draw an arrow from it to the circle with e.g. draw [->] (eq) -- (-20:4);, again using polar coordinates.

In the code below I used polar coordinates to place the P and Q nodes as well, and included a style for the dots, and used labels for the P/Q labels. Obviously your method with a second node works fine as well, so this is mostly a matter of personal preference I guess. Polar coordinates are quite convenient in this case though. Oh, and I used the circle construct to make the circle instead of an arc.

enter image description here

documentclass{article}%
usepackage[utf8]{inputenc}

usepackage{tikz}

begin{document}

begin{tikzpicture}[dot/.style={circle,fill,inner sep=3pt, outer sep=0}]

%coordinate system
draw[thick,->] (0,-5) -- (0,5) node[above left]{$y$};
draw[thick,->] (-5,0) -- (5,0) node[below right]{$x$};
    
%circle
draw (0,0) circle[radius=4cm];

%dots 
path [red]  (45:4)  node[dot, label={above right:{$Q=(cos v,sin v)$}}] (p) {};
path [blue] (135:4) node[dot, label={above left:{$P=(cos u,sin u)$}}] (q) {};

%line joining dots
draw[magenta] (p) -- (q) node[midway, above left ]{$d$};
draw [red]    (0,0) -- (p);
draw [blue]   (0,0) -- (q);

%angles
draw [->] (2,0) arc (0:135:2) node[midway,above right] {$u$};
draw [->] (1,0) arc (0:45:1)  node[midway,above right] {$v$};

node (eq) at (-10:6cm) {$x^2 + y^2 = 1$};    
draw [->] (eq) to[bend left] (-30:4);

end{tikzpicture}

end{document}

Correct answer by Torbjørn T. on November 26, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP