# Drawing a isosceles triangle on Cartesian plane

An isosceles triangle is to be drawn on the Cartesian plane. The two legs of equal length are to be in the first and second quadrants. (The code that I have gives angles of the two legs as 41 degrees and 122 degrees with respect to the positive x-axis.) The two legs are to be labeled "1" and the third leg is to be labeled "c" - I guess below the edge so as not to interfere with the circle.

In the following code, the two legs having an endpoint at the origin are to be of length 1. How can I get TikZ to do the necessary calculations so as to keep the angles of 41 degrees and 122 degrees? The origin is labeled "O" but it interferes with the y-axis. I would like to overlay it or move it to the third quadrant. (I tried the command \node[mydot,label={below,left:$O$}] at (O) {};.)

\documentclass[10pt]{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools,array}

\newlength{\widestright}
\newenvironment{horriblesystem}[1]
{\settowidth{\widestright}{${}=#1$}%
\left\{\,
\begin{array}{@{}r@{}>{\raggedright\arraybackslash${}}p{\widestright}<{$}@{}}}
{\end{array}\right.}

\usepackage{tikz}

\tikzset{
mydot/.style={
fill,
circle,
inner sep=1.5pt
}
}

\begin{document}

\begin{tikzpicture}[>=latex]

% the coordinates of the vertices
\coordinate (O) at (0,0);
\coordinate (A) at (2,1);
\coordinate (B) at (-3,5);

% the axis
\draw[help lines,->] (-3.5,0) -- (2.5,0);
\draw[help lines,->] (0,-0.5) -- (0,5.5);

% the edges of the triangle
\draw (O) -- (A) -- (B) -- cycle;

% labelling the vertices
\node[mydot,label={right:$A$}] at (A) {};
\node[mydot,label={left:$B$}] at (B) {};
\node[mydot,label={below:$O$}] at (O) {};

% the arcs for the angles
\begin{scope}[gray]
\draw[->]
(1,0) +(0:0.5cm) arc [radius=1cm,start angle=0,end angle=41] node[midway,right] {$\alpha$};
\draw[->]
(0.5,0) +(0:0.25cm) arc [radius=0.75cm,start angle=0,end angle=122] node[midway,above] {$\beta$};
\end{scope}

\end{tikzpicture}

\end{document}

-
For your second question, \node[mydot,label={below left:$O$}] at (O) {}; (below left, not below,left) should do. –  Paul Gessler Aug 14 '14 at 1:45

One option using polar coordinates (see remarks below):

The code:

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{angles,quotes}

\tikzset{
mydot/.style={
fill,
circle,
inner sep=1.5pt
}
}
\def\Side{6cm}
\begin{document}

\begin{tikzpicture}[>=latex]
% the coordinates of the vertices
\coordinate (O) at (0,0);
\path  ++(122:\Side) coordinate (A) ++(-40:\Side)
coordinate (B);

% auxiliary coordinates to draw the marks for the angles
\coordinate (aux) at (3,0);

% the axis
\draw[help lines,->] (-3.5,0) -- (2.5,0);
\draw[help lines,->] (0,-0.5) -- (0,5.5);

% the edges of the triangle
\draw
(O) --
node[auto] {$l$}
(A) --
node[auto] {$l$}
(B) --
node[auto] {$c$}
cycle;

% labelling the vertices
\node[mydot,label={above:$A$}] at (A) {};
\node[mydot,label={right:$B$}] at (B) {};
\node[mydot,label={below left:$O$}] at (O) {};

% the arcs for the angles
\begin{scope}[gray,angle eccentricity=1.2,->]
\path
pic[draw,angle radius=1.5cm,"$\alpha$"] {angle = aux--O--B}
pic[draw,->,angle radius=0.75cm,"$\beta$"] {angle = aux--O--A}
;
\end{scope}
\end{tikzpicture}

\end{document}


## Remarks

1. The vertices can be obtained using polar coordinates:

% the coordinates of the vertices
\coordinate (O) at (0,0);
\path  ++(122:\Side) coordinate (A) ++(-40:\Side)
coordinate (B);

2. The labels for the sides can be produced using nodes:

% the edges of the triangle
\draw
(O) --
node[auto] {$l$}
(A) --
node[auto] {$l$}
(B) --
node[auto] {$c$}
cycle;

3. It's easier to use the angles and quotes libraries to produce the marks for the angles:

\path
pic[draw,angle radius=1.5cm,"$\alpha$"] {angle = aux--O--B}
pic[draw,->,angle radius=0.75cm,"$\beta$"] {angle = aux--O--A}
;

4. Using \Side you easily change the length for the lengths.

-
I got the following error: "! I can't find file tikzlibraryangles.code.tex'." I would prefer to use the basic commands in TikZ. The following code is adapted from another post. "\draw[->] (1,0) +(0:0.5cm) arc [radius=1cm, start angle=0,end angle=41] node[midway,right]{$\alpha$}" What does "+(0:0.5cm)" instruct TikZ to draw? I would like to use such a command for drawing beta. I edited the posting - the legs of equal length should have an endpoint at the origin. I guess that the code would be something like the following. \path ++(122:\Side) coordinate (A) ++(41:\Side) coordinate (B) –  user60254 Aug 15 '14 at 13:16
What is "++" in the code "\path ++(122:\Side) coordinate (A)" instructing LaTeX to typeset? –  user60254 Aug 15 '14 at 13:17
Where does "node[auto] {$l$}" instruct TikZ to place the label "l" along a particular side of the triangle? Is it always in the middle? If it does not place it in the middle, is there a command to place it in the middle ... and over other features of the graph? –  user60254 Aug 21 '14 at 15:47

This one uses intersections library and you have to know the lengths of two sides. For rest, I have taken Gonzalo's code as such.

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{angles,quotes,intersections}

\tikzset{
mydot/.style={
fill,
circle,
inner sep=1.5pt
}
}

%% two sides
\def\Side{6cm}
\def\side{2cm}
\begin{document}

\begin{tikzpicture}[>=latex]
% the coordinates of the two vertices
\coordinate (O) at (0,0);
\coordinate (A) at (122:\Side);
\begin{pgfinterruptboundingbox}
\path[name path global=circle] (A) circle (\Side);
\path[name path global=line] (O)circle (\side);
\end{pgfinterruptboundingbox}
\path[name intersections={of=line and circle}];
\coordinate (B) at (intersection-1);   %% third vertex
\draw (O) -- (B) -- (A) -- cycle;

% auxiliary coordinates to draw the marks for the angles
\coordinate (aux) at (3,0);

% the axis
\draw[help lines,->] (-3.5,0) -- (2.5,0);
\draw[help lines,->] (0,-0.5) -- (0,5.5);

% the edges of the triangle
\draw
(O) --
node[auto] {$l$}
(A) --
node[auto] {$l$}
(B) --
node[auto] {$c$}
cycle;

% labelling the vertices
\node[mydot,label={above:$A$}] at (A) {};
\node[mydot,label={right:$B$}] at (B) {};
\node[mydot,label={below left:$O$}] at (O) {};

% the arcs for the angles
\begin{scope}[gray,angle eccentricity=1.2,->]
\path
pic[draw,angle radius=1.5cm,"$\alpha$"] {angle = aux--O--B}
pic[draw,->,angle radius=0.75cm,"$\beta$"] {angle = aux--O--A}
;
\end{scope}
\end{tikzpicture}

\end{document}


Illustration with

\path[draw,red,name path global=circle] (A) circle (\Side);
\path[draw,red,name path global=line] (O)circle (\side);


gives

-
But the value of angle \alpha can't be regulated accurately. Instead the third side OB is controlled. –  Harish Kumar Aug 14 '14 at 4:29
Thanks for the code that illustrates the environment pgfinterruptboundingbox. I am just trying to use the basic commands to draw triangles and angles. I will ask two questions about your code. What is the optional argument in the environment \begin{tikzpicture}[>=latex]? I know that TikZ puts point A at a distance of 6cm from the origin and at an angle of 122 degrees with respect to the positive x-axis with the command \coordinate (A) at (122:\Side);? ("\Side" represents 6cm.) Similar with code for point B. Will TikZ draw the triangle with \draw O -- A -- B cycle;? –  user60254 Aug 15 '14 at 16:11
@user60254 >=latex will make every arrow head to be latex style. I think I didn't get your second query right. –  Harish Kumar Aug 15 '14 at 22:42

Hmm, judging from the other answers perhaps I don't understand the OP's requirements because I though that this was the required image:

I also used the pic syntax with the angles and quotes libraries so this requires the latest PGF release:

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{angles,quotes}
\tikzset{mydot/.style={ fill,  circle,  inner sep=1.5pt }}

\begin{document}
\begin{tikzpicture}[>=latex]

% the coordinates of the vertices
\coordinate (O) at (0:0);
\coordinate (A) at (41:5);
\coordinate (B) at (122:5);

% the axis
\draw[help lines,->] (-3,0) -- (4,0) coordinate (X);
\draw[help lines,->] (0,-0.5) -- (0,5);

% the edges of the triangle
\draw (O)
-- (A)   node [midway, below right] {$l$}
-- (B)   node [midway, above]       {$c$}
-- cycle node [midway, below left]  {$l$};

% labelling the vertices
\node[mydot,label={right:$A$}]      at (A) {};
\node[mydot,label={left:$B$}]       at (B) {};
\node[mydot,label={below left:$O$}] at (O) {};

% the arcs for the angles
\begin{scope}[gray]
\path pic ["$\alpha$", draw, ->, angle eccentricity=1.10, angle radius=1.5cm]
{angle=X--O--A};
\path pic ["$\beta$",  draw, ->, angle eccentricity=1.25, angle radius=1.0cm]
{angle=X--O--B};
\end{scope}
\end{tikzpicture}
\end{document}
`
-