MAS116/MAS117 PRESENTATION LAB 3

This week we’ll use a different text editor as an alternative to TeXworks.

If you’re using Linux or macOS, rather than Windows, then it is fine to stick with your usual editor in this lab. However, if you are feeling adventurous and on top of everything then you could always experiment with a different editor, such as Visual Studio Code with LaTeX Workshop; you should be able to find instructions online.

Remember, text editors are just software used to type in LaTeX commands, so all the things learnt so far still apply.

1. The TeXmaker editor

On the Start Menu, search for TeXmaker and start it. If it’s not there, install it from the Software Center.

If you can’t get TeXmaker to work, you should just use TeXworks instead for this week.

Once TeXmaker has started, create a LaTeX document (using File | New on the menu bar). In TeXmaker you process a LaTeX file by pressing the blue arrow next to ‘Quick build’.

2. Typesetting practice

If you haven’t done so already, start a new file. Include the usual preamble (using documentclass, begin and end document commands etc). You could just cut and paste the preamble from the Lab 2 attempt on the website. Save it as lab_3.tex.

Add the title ‘MAS116: Lab 3 Experiments’. Include the American Mathematical Society (AMS) packages with the commands in the preamble.

    \usepackage{amssymb}
    \usepackage{amsthm}

(1)
Start a section called ‘Typesetting practice’. Begin an enumerate environment and typeset the following as the first \item.

The formula for the addition of velocities in relativistic mechanics is
f(u,v) = u + v 1 + uv c2 .

Once you’ve typed it in, see what happens as you move your cursor past the brackets in the code.

(2)
Now you can look at some of the features of TeXmaker. By clicking on the small λ and buttons on the left-hand side of the screen, typset the following as the second \item on your list.

TeXmaker makes it easy to find Greek letters and to typeset things like
ΞΨΩ = 𝜃 γ.
(3)
Explore the buttons on the left further to see if you can add another item with the following.

Pointing and clicking in TeXmaker also helps with things like
n times.

The construction you are trying to get here is called an ‘underbrace’. Getting text underneath something is usally done with the subscript underscore _. The command \text{} allows text in maths mode and should help with the ‘n times’. You get ‘’ with \ldots.

(4)
The amssymb package allows you to use ‘Blackboard bold’ font which you will sometimes need. Can you typeset the following?

Typically we use to denote the real numbers and to denote the complex numbers.

There is an online tool called ‘Detexify’ that can help you find the LaTeX command for a given symbol. Try it.

3. Theorems

Start a new section called ‘The square-root of 2’. Here we’re going to experiment further with environments, in particular the ‘thoerem-like’ environments provided by the amsthm package.

(5)
Start with the following.
           We are going to investigate a solution of the
           equation
           \begin{equation}
               x^2=2.
           \end{equation}

Process this. The equation environment creates a numbered equation.

(6)
We want to be able to refer to the equation we’ve just created. To do this, put \label{eq:root-2} after \begin{equation}.
(7)
Now type
           The positive solution to equation~(\ref{eq:root-2})
           is denoted $\sqrt{2}$.

and process the file. Does it work? If you see ‘??’ on your PDF, run it again. (LaTeX has to run twice to get autoreferencing to work.)

Now let’s make our first theorem. Add the following to the preamble after the line where you include the amsthm package.

    \newtheorem{thm}{Theorem}[section]

This will create a new environment called thm, which is numbered inside sections. In the body of the document, write

    \begin{thm}
        The real number $\sqrt{2}$ is irrational.
    \end{thm}

Process the file, and look at the output. The theorem should be numbered something like 2.1, where the 2 refers to the section number. Underneath the theorem, write

    \begin{proof}
        We prove this by contradiction.  First we assume
        that $\sqrt{2}$ is rational and so can be written
        as $a/b$ for \emph{coprime} integers $a$ and $b$.
        Blah blah blah.
    \end{proof}

Here we’ve written ab rather than a b. Which looks better? In this case, I don’t think there’s a right answer.

We’ve started the proof by relying on a certain mathematical fact. Let’s include this as a lemma: a lemma is a short, usually uninteresting result in its own right which is used as an intermediate step towards a proposition or theorem. In order of importance, theorems come above propositions, which come above lemmas.

To include the lemma, you should first add the following in the preamble after the \newtheorem{thm} command.

    \newtheorem{lem}[thm]{Lemma}

This creates a new environment called lem, which is numbered the same as the thm environment. Using this new environment, put a lemma before the statement of the theorem that looks like the following.

Lemma 3.1. Any rational number can be written in the form ab with a and b coprime integers.

Proof. Suppose that we have a rational number pq where p and q are integers with q0. Blah blah blah.

When you process the file, notice how the numbering for the theorem automatically changes.

Add the following commands in the preamble after \newtheorem{lem}.

    \theoremstyle{definition}
    \newtheorem{defn}[thm]{Definition}

Now change the line where you defined 2 into a definition using \begin{defn} and \end{defn} to make the following.

Definition 3.2. The positive solution to equation (1) is denoted 2.

Again, the numbering will automatically change. Look carefully at how the lemma and the definition are typeset and see if you can find the difference that \theoremstyle{definition} has made.

Here the amsthm package is using the mathematical typesetting convention is that the statements of theorems, propositions and lemmas are typeset with slanted text, whereas defintions are typeset with upright text. Experiment with labelling and referencing your definition, lemma and theorem which is done in the same way as for equations.

You can read more about how the \newtheorem command works on the webpage http://en.wikibooks.org/wiki/LaTeX/Theorems.

Homework

Create a document with title ‘MAS116: Homework 3’ (or ‘MAS117’)and your name on as author. Using the work you started in this sheet, write a good account of what the square root of 2 is and why it is irrational by adding proper proofs of the lemma and theorem.

More specifically, you need to include a detailed proof of why any rational number can be written as ab in such a way that a and b are coprime, and you also need a full proof that 2 is irrational.

Hand in printouts of the PDF and LaTeX files at next week’s lab, as usual.

_____________________________________________________________________

4. The square-root of 2 (my lab attempt!)

Here, we’re going to investigate a solution of the equation

x2 = 2.
(1)

Definition 4.1. The positive solution to equation (1) is denoted 2.

Lemma 4.2. Any rational number can be written in the form ab with a and b coprime integers.

Proof. Suppose that we have a rational number pq where p and q are integers with q0. Blah blah blah.

Theorem 4.3. The real number 2 is irrational.

Proof. We prove this by contradiction. First we assume that 2 is rational and so can be written as ab for coprime integers a and b. Blah blah blah.