Skip to content

Instantly share code, notes, and snippets.

@uzluisf
Created January 13, 2019 02:42
Show Gist options
  • Save uzluisf/f62230ade462e845f85e56206605c3dc to your computer and use it in GitHub Desktop.
Save uzluisf/f62230ade462e845f85e56206605c3dc to your computer and use it in GitHub Desktop.
A simple LaTex template for Math homeworks.
% Resources:
% http://www-math.mit.edu/~psh/exam/examdoc.pdf
% https://www.math.uni-bielefeld.de/~rost/amslatex/doc/amsthdoc.pdf
\documentclass[addpoints,answers,12pt]{exam} % exam class with 12 point type
\usepackage[T1]{fontenc} % replace default font encoding (OT1)
\usepackage{tgschola} % font used in the Book of Proof
\usepackage{amsmath,amsthm,amssymb,amsfonts} % packages for mathematical typesetting
\usepackage{pdfpages} % include pdf pages with \includepdf{dir/of/page.pdf}
\usepackage[makeroom]{cancel} % display expressions as cancelled
%%%%%%%%%%%%%%%%%%%%%%
% START CONFIGURATION
%%%%%%%%%%%%%%%%%%%%%%
% header and footer style
\pagestyle{headandfoot}
\firstpageheadrule % put horizontal line on header of 1st page
\runningheadrule % put horizontal line on header after 1st page
\firstpageheader{\student}{\subject \mbox{ ---} \assignment}{\dt}
\runningheader{\student}{\subject \mbox{ ---} \assignment}{\dt}
\firstpagefooter{}{}{} % put nothing on footer of 1st page
\runningfooter{}{}{} % put nothing on footer after 1st page
% set some set symbols
\newcommand{\N}{\mathbb N}
\newcommand{\Z}{\mathbb Z}
\newcommand{\Q}{\mathbb Q}
\newcommand{\R}{\mathbb R}
\newcommand{\C}{\mathbb C}
% redefine tombstone symbol used at the of proofs
\renewcommand{\qedsymbol}{$\blacksquare$}
% (uncomment to) place each section on its own page
%\let\stdsection\section\renewcommand\section{\newpage\stdsection}
%%%%%%%%%%%%%%%%%%%%%%
% START CONFIGURATION
%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%
% ASSIGNMENT INFO
% (Update accordingly!)
%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\student}{John Doe}
\newcommand{\subject}{Math Class}
\newcommand{\assignment}{Homework 00}
\newcommand{\dt}{\today}
\begin{document}
\begin{questions}
\question{Prove that $ \sum_{i=1}^{n} i = \frac{n(n+1)}{2} $ for $ n \ge 0 $, by induction.}
\begin{solution}
\begin{proof}\hfil
\textbf{Base case.} When $ n = 0 $, LHS = $ 0 $ and RHS = $ \frac{0\cdot 1}{2} = 0$. Thus RHS = LHS.
\textbf{Inductive step.} We assumed that $ \sum_{i=1}^{q} i = \frac{q(q+1)}{2} $ is true for an arbitrary fixed integer $ q $ and attempt to prove the validity of the formula for $ (q+1) $. Thus
\begin{align*}
\sum_{i=1}^{q+1} i &= \underbrace{\sum_{i=1}^{q} i}_{\frac{q(q+1)}{2}} + (q+1) \\
&= \frac{q(q+1)}{2} + (q+1) \\
&= \frac{q(q+1) + 2(q+1)}{2} \\
&= \frac{(q+1)(q+1)}{2} \mbox{.}
\end{align*}
which is precisely the right-side of $ \sum_{i=1}^{n} i = \frac{n(n+1)}{2} $ when $ n = (q+1) $.
Therefore, by the principle of mathematical induction, $ \sum_{i=1}^{n} i = \frac{n(n+1)}{2} $.
\end{proof}
\end{solution}
\end{questions}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment