# OpenLearn Geometry¶

This notebook recreates some of the content featured in the OpenLearn course Geometry.

The notebook includes several hidden code cells that generate the a range of geometric figures.

To render the images, go to the Cell menu and select Run All.

To view/hide the code used to generate the figures, click on the Hide/Reveal Code Cell Inputs button in the notebook toolbar.

To make changes to the diagrams, click in the appropriate code input cell, make your change, and then run the cell using the Run Cell ("Play") button in the toolbar or via the keyboard shortcut SHIFT-ENTER.

Entering Ctrl-Z (or CMD-Z) in the code cell will undo your edits...

## Angles¶

The Try some yourself activity includes the following shape.

In [1]:
%load_ext tikz_magic

In [2]:
%%tikz
\usetikzlibrary{positioning}

\coordinate (A) at (0,0) ;
\coordinate (B) at (5,0.3) ;
\coordinate (C) at (4.5,-2) ;
\coordinate (D) at (2,-3) ;

\draw (A) node[left]{A}  -- (B)node[right]{B};
\draw  (B) -- (C)node[right]{C};
\draw  (C)  -- (A) ;
\draw  (A)  -- (D) node[below]{D};
\draw  (D) -- (C);

\begin{scope}
\clip (B) -- (A) -- (C);
\end{scope}
\node at (A)[below right=-0.05 and 0.5 ] {$\alpha$};

\begin{scope}
\clip (C) -- (A) -- (D);
\end{scope}
\node at (A)[below right=0.3 and 0.3 ] {$\gamma$};

\begin{scope}
\clip (B) -- (C) -- (A);
\end{scope}
\node at (C)[above left=0.25 and 0.2 ] {$\beta$};

\begin{scope}
\clip (A) -- (C) -- (D);
\end{scope}
\node at (C)[left=0.4 ] {$\delta$};

Out[2]:

## Geometric shapes – circles¶

All circles are the same shape – they can only have different sizes.

In a circle, all the points are the same distance from a point called the centre. The centre is often labelled with the letter O.

In [3]:
%%tikz
%https://tex.stackexchange.com/a/223219

\def\tilt{30}% angle for the arc

%origin
\coordinate (O) at (0,0) ;

% Circle

%Centre point

%Diameter
%latex-latex defines the 'latex' arrow head at each end of the line
node[font=\tiny,above, midway,rotate=\tilt]{Diameter};

%Circumference
\draw (\tilt+30:\radius) -- +(0.5,1) -- +(0.75,1) node [right]{\tiny{Circumference}} ;

Out[3]:

The outside edge of a circle is called the circumference. A straight line from the centre to a point on the circumference is called a radius of the circle (the plural of radius is radii).

A line with both ends on the circumference and passing through the centre is called a diameter. Any diameter cuts the circle into two halves called semicircles.

In [17]:
%%tikz

%origin
\coordinate (O) at (0,0) ;

%Draw dashed semi-circle

%Draw grey semicircle -  the -- cycle component closes the shape
%Close the figure and add a diameter label
-- cycle node [font=\tiny,below,midway]{Diameter};

%Centre point

%Circumference label - build a relative line to connent circumference and label
\draw (30:\radius) -- ++(0.5,1) -- +(0.25,0) node [font=\tiny,right,
align=left]{Half the \\ circumference} ;

Out[17]:

In the circle below, the lines labelled OA, OB, OC, OD and OE are all radii, and AD and BE are diameters. The points A, B, C, D and E all lie on the circumference.

In [5]:
%%tikz

%origin
\coordinate (O) at (0,0) ;

% Circle

%Centre point

\draw (O) -- (60:\radius) node[font=\tiny,above right]{B};

Out[5]:

Although the terms ‘radius’, ‘diameter’ and ‘circumference’ each denote a certain line, these words are also employed to mean the lengths of those lines. So it is common to say, for example, ‘Mark a point on the circumference’ and ‘The circumference of this circle is 7.3 cm’. It is obvious from the context whether the line itself or the length is being referred to.

### Extra Examples¶

Handy fragments from Stack Overflow..

In [6]:
%%tikz
%https://tex.stackexchange.com/a/197711
\path (120:3) coordinate (A) (0:3) coordinate (B) (0:0) coordinate (C);
\draw (A)
-- (B) node [at start, above left] {$A$} node [midway, above] {$c$}
-- (C) node [at start, right]      {$B$} node [midway, below] {$a$}
-- (A) node [at start, below]      {$C$} node [midway, below] {$b$}
-- cycle;
\draw [dashed] (A) |- (C) node [midway, below left] {$P$};

%The -- (60:.6) element adds the tick to the angle
\draw (0:.5) arc (0:120:.5) (60:.4) -- (60:.6);

Out[6]:
In [ ]:


In [4]:
%%tikz --no-wrap
%via https://tex.stackexchange.com/a/397793/151162
\usetikzlibrary{angles,quotes}

\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$};
\def\a{40}
\path
(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];
\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$};