feat: change up organisation
This commit is contained in:
parent
13f372ec5a
commit
dd56398b7d
1
Readme.md
Normal file
1
Readme.md
Normal file
@ -0,0 +1 @@
|
||||
Cheatsheets built with reference from [jovyntls/cheatsheets](https://github.com/jovyntls/cheatsheets). Thanks for the great work and reference latex formatting!
|
601
cheatsheets/cs1231s/1231num.sty
Normal file
601
cheatsheets/cs1231s/1231num.sty
Normal file
@ -0,0 +1,601 @@
|
||||
%% This is file `1231num.sty',
|
||||
%% Copyright (C) 2021 by Tin Lok Wong
|
||||
%%
|
||||
%% This work may be distributed and/or modified under the conditions
|
||||
%% of the LaTeX Project Public License, either version 1.3 of this
|
||||
%% license or (at your option) any later version. The latest version
|
||||
%% of this license is in
|
||||
%%
|
||||
%% http://www.latex-project.org/lppl.txt
|
||||
%%
|
||||
%% and version 1.3 or later is part of all distributions of LaTeX
|
||||
%% version 2005/12/01 or later.
|
||||
%%
|
||||
%% This work has the LPPL maintenance status `maintained'.
|
||||
%%
|
||||
%% The Current Maintainer of this work is Tin Lok Wong.
|
||||
%%
|
||||
%% File last modified: 2021/10/06
|
||||
|
||||
% If hyperref is needed, then load it first.
|
||||
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\ProvidesPackage{1231num}[2021/02/26 v0.0 CS1231 line numbers]
|
||||
|
||||
\RequirePackage{amsmath}% to align in math
|
||||
\RequirePackage{tabto}% for starting a pfarray mid-line
|
||||
|
||||
\newlength{\numpf@templen}
|
||||
|
||||
\let\pfln\item
|
||||
\let\lnref\ref
|
||||
|
||||
% Parameters that controls the margins for proofs
|
||||
\newlength{\pfmargin} \setlength{\pfmargin}{1em}
|
||||
\newlength{\pflabelwdI} \setlength{\pflabelwdI}{1.2em}
|
||||
\newlength{\pflabelwdII} \setlength{\pflabelwdII}{2.0em}
|
||||
\newlength{\pflabelwdIII}\setlength{\pflabelwdIII}{2.8em}
|
||||
\newlength{\pflabelwdIV} \setlength{\pflabelwdIV}{3.6em}
|
||||
\newlength{\pflabelwdV} \setlength{\pflabelwdV}{4.4em}
|
||||
\newlength{\pflabelwdi}
|
||||
\newlength{\pflabelwdii}
|
||||
\newlength{\pflabelwdiii}
|
||||
\newlength{\pflabelwdiv}
|
||||
\newlength{\pflabelwdv}
|
||||
% Define the usual spacing around and within proofs.
|
||||
\def\numpf@seti{%
|
||||
\def\@listi{\leftmargin\pflabelwdi
|
||||
\advance\leftmargin\labelsep
|
||||
\labelwidth\pflabelwdi
|
||||
\topsep \z@
|
||||
\parsep \z@
|
||||
\itemsep \z@
|
||||
\partopsep\z@}%
|
||||
}
|
||||
\def\numpf@setii{%
|
||||
\def\@listii{\leftmargin\pflabelwdii
|
||||
\advance\leftmargin\labelsep
|
||||
\labelwidth\pflabelwdii
|
||||
\topsep \z@
|
||||
\parsep \z@
|
||||
\itemsep \z@
|
||||
\partopsep\z@}%
|
||||
}
|
||||
\def\numpf@setiii{%
|
||||
\def\@listiii{\leftmargin\pflabelwdiii
|
||||
\advance\leftmargin\labelsep
|
||||
\labelwidth\pflabelwdiii
|
||||
\topsep \z@
|
||||
\parsep \z@
|
||||
\itemsep \z@
|
||||
\partopsep\z@}%
|
||||
}
|
||||
\def\numpf@setiv{%
|
||||
\def\@listiv {\leftmargin\pflabelwdiv
|
||||
\advance\leftmargin\labelsep
|
||||
\labelwidth\pflabelwdiv
|
||||
\topsep \z@
|
||||
\parsep \z@
|
||||
\itemsep \z@
|
||||
\partopsep\z@}%
|
||||
}
|
||||
\def\numpf@setv{%
|
||||
\def\@listv {\leftmargin\pflabelwdv
|
||||
\advance\leftmargin\labelsep
|
||||
\labelwidth\pflabelwdv
|
||||
\topsep \z@
|
||||
\parsep \z@
|
||||
\itemsep \z@
|
||||
\partopsep\z@}%
|
||||
}
|
||||
% Alternative set of spacing that saves more space.
|
||||
\def\numpf@seti@star{%
|
||||
\def\@listi{\leftmargin\z@
|
||||
\labelwidth\pflabelwdi
|
||||
\topsep \z@
|
||||
\parsep \z@
|
||||
\itemsep \z@
|
||||
\partopsep \z@}%
|
||||
}
|
||||
\def\numpf@setii@star{%
|
||||
\def\@listii{\leftmargin\pfmargin
|
||||
\labelwidth\pflabelwdii
|
||||
\topsep \z@
|
||||
\parsep \z@
|
||||
\itemsep \z@
|
||||
\partopsep\z@}%
|
||||
}
|
||||
\def\numpf@setiii@star{%
|
||||
\def\@listiii{\leftmargin\pfmargin
|
||||
\labelwidth\pflabelwdiii
|
||||
\topsep \z@
|
||||
\parsep \z@
|
||||
\itemsep \z@
|
||||
\partopsep\z@}%
|
||||
}
|
||||
\def\numpf@setiv@star{%
|
||||
\def\@listiv {\leftmargin\pfmargin
|
||||
\labelwidth\pflabelwdiv
|
||||
\topsep \z@
|
||||
\parsep \z@
|
||||
\itemsep \z@
|
||||
\partopsep\z@}%
|
||||
}
|
||||
\def\numpf@setv@star{%
|
||||
\def\@listv {\leftmargin\pfmargin
|
||||
\labelwidth\pflabelwdv
|
||||
\topsep \z@
|
||||
\parsep \z@
|
||||
\itemsep \z@
|
||||
\partopsep\z@}%
|
||||
}
|
||||
|
||||
% There are several places in which
|
||||
% things with beamer are different from standand LaTeX:
|
||||
% - the max depth of enumerate allowed;
|
||||
% - the way enumerate displays the numbering;
|
||||
% - the macros used to display the numbers;
|
||||
% - the need to specify colours and fonts with beamer;
|
||||
% - overlay options are available with beamer;
|
||||
% - beamer sets additional parameters when entering a new enumerate.
|
||||
\@ifclassloaded{beamer}{%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Definitions for standard BEAMER %
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Here I increase the max depth of the enumerate environment.
|
||||
% Modified from beamerbaselocalstructure.sty
|
||||
\@definecounter{enumiv}
|
||||
\@definecounter{enumv}
|
||||
\setlength\leftmarginiv{2em}
|
||||
\setlength\leftmarginv {2em}
|
||||
\def\@listiv {\leftmargin\leftmarginiv
|
||||
\labelwidth\leftmarginiv
|
||||
\advance\labelwidth-\labelsep}
|
||||
\def\@listv {\leftmargin\leftmarginv
|
||||
\labelwidth\leftmarginv
|
||||
\advance\labelwidth-\labelsep}
|
||||
\def\numpf@enumerate{%
|
||||
\ifnum\@enumdepth>4\relax\@toodeep
|
||||
\else%
|
||||
\advance\@enumdepth\@ne%
|
||||
\edef\@enumctr{enum\romannumeral\the\@enumdepth}%
|
||||
\advance\@itemdepth\@ne%
|
||||
\fi%
|
||||
\beamer@computepref\@enumdepth% sets \beameritemnestingprefix
|
||||
\edef\beamer@enumtempl{enumerate \beameritemnestingprefix item}%
|
||||
\@ifnextchar[{\beamer@@enum@}{\beamer@enum@}}
|
||||
\let\endnumpf@enumerate\endenumerate
|
||||
\def\beamer@computepref#1{%
|
||||
\let\beameritemnestingprefix\@empty%
|
||||
\ifcase#1\or\or\def\beameritemnestingprefix{sub}\or
|
||||
\def\beameritemnestingprefix{subsub}\or
|
||||
\def\beameritemnestingprefix{subsubsub}\or
|
||||
\def\beameritemnestingprefix{subsubsubsub}\or
|
||||
\@toodeep\fi}
|
||||
\def\insertsubsubsubenumlabel{\theenumiv}
|
||||
\def\insertsubsubsubsubenumlabel{\theenumv}
|
||||
% Modified from beamercolorthemedefault.sty
|
||||
\setbeamercolor{subsubsubitem}{parent=subsubitem}
|
||||
\setbeamercolor{subsubsubsubitem}{parent=subsubsubitem}
|
||||
\setbeamercolor{enumerate subsubsubitem}{parent=subsubsubitem}
|
||||
\setbeamercolor{enumerate subsubsubsubitem}{parent=subsubsubsubitem}
|
||||
% Modified from beamerfontthemedefault.sty
|
||||
\setbeamerfont{enumerate subsubsubitem}{parent=subsubsubitem}
|
||||
\setbeamerfont{enumerate subsubsubsubitem}{parent=subsubsubsubitem}
|
||||
\setbeamerfont{itemize/enumerate body}{}
|
||||
\setbeamerfont{itemize/enumerate subbody}{size=\normalfont}
|
||||
\setbeamerfont{itemize/enumerate subsubbody}{size=\normalfont}
|
||||
\setbeamerfont{itemize/enumerate subsubsubbody}{size=\normalfont}
|
||||
\setbeamerfont{itemize/enumerate subsubsubsubbody}{size=\normalfont}
|
||||
\setbeamercolor{enumerate subsubsubbody}{}
|
||||
\setbeamercolor{enumerate subsubsubsubbody}{}
|
||||
% Modified from beamerinnerthemedefault.sty
|
||||
\defbeamertemplate*{enumerate subsubsubitem}{default}
|
||||
{\usebeamertemplate*{enumerate subsubitem}\insertsubsubsubenumlabel.}
|
||||
\defbeamertemplate*{enumerate subsubsubsubitem}{default}
|
||||
{\usebeamertemplate*{enumerate subsubsubitem}\insertsubsubsubsubenumlabel.}
|
||||
\defbeamertemplate*{enumerate subsubsubbody begin}{default}{}
|
||||
\defbeamertemplate*{enumerate subsubsubbody end}{default}{}
|
||||
\defbeamertemplate*{enumerate subsubsubsubbody begin}{default}{}
|
||||
\defbeamertemplate*{enumerate subsubsubsubbody end}{default}{}
|
||||
% The proof environments in text mode
|
||||
\newenvironment{numpf}
|
||||
{\numpf@
|
||||
\begin{subpf}}
|
||||
{\end{subpf}\ignorespacesafterend}
|
||||
\newenvironment{numpf*}
|
||||
{\numpf@
|
||||
\begin{subpf*}}
|
||||
{\end{subpf*}\ignorespacesafterend}
|
||||
\newcommand{\numpf@}{%
|
||||
% Modified from beamerbaselocalstructure.sty to make left-aligned numbers
|
||||
\def\beamer@enum@{%
|
||||
\beamer@computepref\@itemdepth% sets \beameritemnestingprefix
|
||||
\usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
|
||||
\usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
|
||||
\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
|
||||
\expandafter
|
||||
\list
|
||||
{\usebeamertemplate{\beamer@enumtempl}}
|
||||
{\usecounter\@enumctr%
|
||||
\def\makelabel####1{{\hss\rlap{{%
|
||||
\usebeamerfont*{enumerate \beameritemnestingprefix item}%
|
||||
\usebeamercolor[fg]{enumerate \beameritemnestingprefix item}####1}}}\hfill}}%
|
||||
\beamer@cramped%
|
||||
\raggedright%
|
||||
\beamer@firstlineitemizeunskip}%
|
||||
% Modified from beamerinnerthemedefault.sty
|
||||
\setbeamertemplate{enumerate item}{\insertenumlabel.}%
|
||||
\setbeamertemplate{enumerate subitem}
|
||||
{\usebeamertemplate*{enumerate item}\insertsubenumlabel.}%
|
||||
\setbeamertemplate{enumerate subsubitem}
|
||||
{\usebeamertemplate*{enumerate subitem}\insertsubsubenumlabel.}%
|
||||
\setbeamertemplate{enumerate subsubsubitem}
|
||||
{\usebeamertemplate*{enumerate subsubitem}\insertsubsubsubenumlabel.}%
|
||||
\setbeamertemplate{enumerate subsubsubsubitem}
|
||||
{\usebeamertemplate*{enumerate subsubsubitem}\insertsubsubsubsubenumlabel.}%
|
||||
\renewcommand{\theenumi}{\arabic{enumi}}%
|
||||
\renewcommand{\theenumii}{\arabic{enumii}}%
|
||||
\renewcommand{\theenumiii}{\arabic{enumiii}}%
|
||||
\renewcommand{\theenumiv}{\arabic{enumiv}}%
|
||||
\renewcommand{\theenumv}{\arabic{enumv}}%
|
||||
\renewcommand{\p@enumi}{}%
|
||||
\renewcommand{\p@enumii}{\theenumi.}%
|
||||
\renewcommand{\p@enumiii}{\p@enumii\theenumii.}%
|
||||
\renewcommand{\p@enumiv}{\p@enumiii\theenumiii.}%
|
||||
\renewcommand{\p@enumv}{\p@enumiv\theenumiv.}%
|
||||
\ifcase\@enumdepth
|
||||
\setlength\pflabelwdi{\pflabelwdI}%
|
||||
\setlength\pflabelwdii{\pflabelwdII}%
|
||||
\setlength\pflabelwdiii{\pflabelwdIII}%
|
||||
\setlength\pflabelwdiv{\pflabelwdIV}%
|
||||
\setlength\pflabelwdv{\pflabelwdV}%
|
||||
\or
|
||||
\setlength\pflabelwdii{\pflabelwdI}%
|
||||
\setlength\pflabelwdiii{\pflabelwdII}%
|
||||
\setlength\pflabelwdiv{\pflabelwdIII}%
|
||||
\setlength\pflabelwdv{\pflabelwdIV}%
|
||||
\setbeamertemplate{enumerate subitem}{\insertsubenumlabel.}%
|
||||
\renewcommand{\p@enumii}{}%
|
||||
\or
|
||||
\setlength\pflabelwdiii{\pflabelwdI}%
|
||||
\setlength\pflabelwdiv{\pflabelwdII}%
|
||||
\setlength\pflabelwdv{\pflabelwdIII}%
|
||||
\setbeamertemplate{enumerate subsubitem}{\insertsubsubenumlabel.}%
|
||||
\renewcommand{\p@enumiii}{}%
|
||||
\or
|
||||
\setlength\pflabelwdiv{\pflabelwdI}%
|
||||
\setlength\pflabelwdv{\pflabelwdII}%
|
||||
\setbeamertemplate{enumerate subsubsubitem}{\insertsubsubsubenumlabel.}%
|
||||
\renewcommand{\p@enumiv}{}%
|
||||
\or
|
||||
\setlength\pflabelwdv{\pflabelwdI}%
|
||||
\setbeamertemplate{enumerate subsubsubsubitem}{\insertsubsubsubsubenumlabel.}%
|
||||
\renewcommand{\p@enumv}{}%
|
||||
\fi}
|
||||
\newenvironment{subpf}
|
||||
{\advance\@enumdepth1
|
||||
\csname numpf@set\romannumeral\the\@enumdepth\endcsname
|
||||
\advance\@enumdepth-1
|
||||
\begin{numpf@enumerate}}
|
||||
{\end{numpf@enumerate}\ignorespacesafterend}
|
||||
\newenvironment{subpf*}
|
||||
{\advance\@enumdepth1
|
||||
\csname numpf@set\romannumeral\the\@enumdepth @star\endcsname
|
||||
\advance\@enumdepth-1
|
||||
\begin{numpf@enumerate}}
|
||||
{\end{numpf@enumerate}\ignorespacesafterend}
|
||||
\newcommand{\linenum}
|
||||
{\usebeamertemplate*{\beamer@enumtempl}}
|
||||
% The \relax seems to help avoid an error
|
||||
% if the immediately preceding \item has an overlay specification.
|
||||
\newenvironment<>{pfarray}[1]
|
||||
{\begin{uncoverenv}#2\pfln\relax\numpf@rray{#1}}
|
||||
{\endarray\end{math}\end{uncoverenv}\ignorespacesafterend}
|
||||
\newcommand{\subpfalign@@set}{%
|
||||
\advance\@enumdepth\@ne
|
||||
\setcounter{enum\romannumeral\the\@enumdepth}{1}%
|
||||
\beamer@computepref\@enumdepth% sets \beameritemnestingprefix
|
||||
\edef\beamer@enumtempl{enumerate \beameritemnestingprefix item}%
|
||||
\let\numpf@amsmathLet@\Let@
|
||||
\def\Let@{\let\\\numpf@spf@lignlb}}
|
||||
}{%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Definitions for standard LaTeX %
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
% Here I define one more layer for the numpf environment.
|
||||
\@definecounter{enumv}
|
||||
% Modified from report.cls
|
||||
\renewcommand\theenumv{\@Roman\c@enumv}
|
||||
\newcommand\labelenumv{\theenumv.}
|
||||
\renewcommand\p@enumv{\p@enumiv\theenumiv}
|
||||
% The proof environments in text mode
|
||||
\newenvironment{numpf}
|
||||
{\numpf@
|
||||
\begin{subpf}}
|
||||
{\end{subpf}\ignorespacesafterend}
|
||||
\newenvironment{numpf*}
|
||||
{\numpf@
|
||||
\begin{subpf*}}
|
||||
{\end{subpf*}\ignorespacesafterend}
|
||||
\newcommand{\numpf@}{%
|
||||
\renewcommand\labelenumi{\theenumi.}%
|
||||
\renewcommand\theenumi{\arabic{enumi}}%
|
||||
\renewcommand\p@enumi{}%
|
||||
\renewcommand\labelenumii{\labelenumi\theenumii.}%
|
||||
\renewcommand\theenumii{\arabic{enumii}}%
|
||||
\renewcommand\p@enumii{\p@enumi\theenumi.}%
|
||||
\renewcommand\labelenumiii{\labelenumii\theenumiii.}%
|
||||
\renewcommand\theenumiii{\arabic{enumiii}}%
|
||||
\renewcommand\p@enumiii{\p@enumii\theenumii.}%
|
||||
\renewcommand\labelenumiv{\labelenumiii\theenumiv.}%
|
||||
\renewcommand\theenumiv{\arabic{enumiv}}%
|
||||
\renewcommand\p@enumiv{\p@enumiii\theenumiii.}%
|
||||
\renewcommand\labelenumv{\labelenumiv\theenumv.}%
|
||||
\renewcommand\theenumv{\arabic{enumv}}%
|
||||
\renewcommand\p@enumv{\p@enumiv\theenumiv.}%
|
||||
\ifcase\@enumdepth
|
||||
\setlength\pflabelwdi{\pflabelwdI}%
|
||||
\setlength\pflabelwdii{\pflabelwdII}%
|
||||
\setlength\pflabelwdiii{\pflabelwdIII}%
|
||||
\setlength\pflabelwdiv{\pflabelwdIV}%
|
||||
\setlength\pflabelwdv{\pflabelwdV}%
|
||||
\or
|
||||
\setlength\pflabelwdii{\pflabelwdI}%
|
||||
\setlength\pflabelwdiii{\pflabelwdII}%
|
||||
\setlength\pflabelwdiv{\pflabelwdIII}%
|
||||
\setlength\pflabelwdv{\pflabelwdIV}%
|
||||
\renewcommand\labelenumii{\theenumii.}%
|
||||
\renewcommand{\p@enumii}{}%
|
||||
\or
|
||||
\setlength\pflabelwdiii{\pflabelwdI}%
|
||||
\setlength\pflabelwdiv{\pflabelwdII}%
|
||||
\setlength\pflabelwdv{\pflabelwdIII}%
|
||||
\renewcommand\labelenumiii{\theenumiii.}%
|
||||
\renewcommand{\p@enumiii}{}%
|
||||
\or
|
||||
\setlength\pflabelwdiv{\pflabelwdI}%
|
||||
\setlength\pflabelwdv{\pflabelwdII}%
|
||||
\renewcommand\labelenumiv{\theenumiv.}%
|
||||
\renewcommand{\p@enumiv}{}%
|
||||
\or
|
||||
\setlength\pflabelwdv{\pflabelwdI}%
|
||||
\renewcommand\labelenumv{\theenumv.}%
|
||||
\renewcommand{\p@enumv}{}%
|
||||
\fi}
|
||||
% Modified from latex.ltx to make left-aligned numbers
|
||||
\newenvironment{subpf}{%
|
||||
\ifnum \@enumdepth >4\@toodeep\else
|
||||
\advance\@enumdepth\@ne
|
||||
\csname numpf@set\romannumeral\the\@enumdepth\endcsname
|
||||
\edef\@enumctr{enum\romannumeral\the\@enumdepth}%
|
||||
\expandafter
|
||||
\list
|
||||
\csname label\@enumctr\endcsname
|
||||
{\usecounter\@enumctr\def\makelabel##1{\hss\rlap{##1}\hfill}}%
|
||||
\fi}{\endlist}
|
||||
\newenvironment{subpf*}{%
|
||||
\ifnum \@enumdepth >4\@toodeep\else
|
||||
\advance\@enumdepth\@ne
|
||||
\csname numpf@set\romannumeral\the\@enumdepth @star\endcsname
|
||||
\edef\@enumctr{enum\romannumeral\the\@enumdepth}%
|
||||
\expandafter
|
||||
\list
|
||||
\csname label\@enumctr\endcsname
|
||||
{\usecounter\@enumctr\def\makelabel##1{\hss\rlap{##1}\hfill}}%
|
||||
\fi}{\endlist}
|
||||
\newcommand{\linenum}
|
||||
{\csname labelenum\romannumeral\the\@enumdepth\endcsname}
|
||||
\newenvironment{pfarray}
|
||||
{\pfln\numpf@rray}
|
||||
{\endarray\end{math}\ignorespacesafterend}
|
||||
\newcommand{\subpfalign@@set}{%
|
||||
\advance\@enumdepth\@ne
|
||||
\setcounter{enum\romannumeral\the\@enumdepth}{1}%
|
||||
\let\numpf@amsmathLet@\Let@
|
||||
\def\Let@{\let\\\numpf@spf@lignlb}}
|
||||
}
|
||||
|
||||
% Here are the proof environments in math mode.
|
||||
% The stem is ``pfalign''.
|
||||
% Prefixing by ``sub'' indicates a new layer in the line numbering.
|
||||
% Suffixing by ``ed'' specifies that the materials are not displayed.
|
||||
% An asterisk used with ``sub'' specifies that
|
||||
% the space-saving margins are to be used.
|
||||
% One can play with the usual parameters to modify the spacing, e.g.,
|
||||
% \jot=0pt
|
||||
% \abovedisplayskip=0pt
|
||||
% \afterdisplayskip=0pt
|
||||
% These have to be issued before the environment starts.
|
||||
% Default overlay specifications in beamer do not apply to these commands.
|
||||
|
||||
\def\numpf@mknum@norm#1{\makebox[\labelwidth][l]{#1}\hspace{\labelsep}}
|
||||
\def\numpf@mknum@star#1%
|
||||
{\hspace{\pfmargin}\hspace{-\labelsep}\hspace{-\labelwidth}%
|
||||
\makebox[\labelwidth][l]{#1}\hspace{\labelsep}}
|
||||
|
||||
\def\numpf@lign@mklbl{%
|
||||
\edef\@currentlabel
|
||||
{\csname p@enum\romannumeral\the\@enumdepth\endcsname
|
||||
\csname theenum\romannumeral\the\@enumdepth\endcsname}%
|
||||
% Adapted from \make@display@tag in amsmath.sty
|
||||
\ifmeasuring@\else
|
||||
\ifx\df@label\@empty\else
|
||||
\@xp\ltx@label\@xp{\df@label}%
|
||||
\global\let\df@label\@empty
|
||||
\fi
|
||||
\fi
|
||||
}
|
||||
|
||||
\newenvironment{subpfalign}
|
||||
{\let\numpf@mknum\numpf@mknum@norm\collect@body\subpfalign@}{}
|
||||
\newenvironment{subpfalign*}
|
||||
{\let\numpf@mknum\numpf@mknum@star\collect@body\subpfalign@}{}
|
||||
\newcommand{\subpfalign@}[1]{\bgroup
|
||||
\ifnum \@enumdepth >4\@toodeep\else\subpfalign@@{#1}\fi
|
||||
\egroup\ignorespaces}
|
||||
\newcommand{\subpfalign@@}[1]{\subpfalign@@set
|
||||
\def\numpf@spf@lignlb{\relax\iffalse{\fi\ifnum0=`}\fi
|
||||
\@ifstar{\numpf@spf@lignlb@star}{\numpf@spf@lignlb@}}%
|
||||
\begin{flalign*}
|
||||
% Hopefully no one uses \Let@ except amsmath.
|
||||
\global\let\Let@\numpf@amsmathLet@
|
||||
&\numpf@mknum{\linenum}%
|
||||
\numpf@lign@mklbl
|
||||
\end{flalign*}}
|
||||
% The starred version has one fewer ampersand before the line break.
|
||||
% Modified from amsmath.sty, especially \math@cr
|
||||
\def\numpf@spf@lignlb@{%
|
||||
\new@ifnextchar[\numpf@spf@lignlb@@{\numpf@spf@lignlb@@[\z@]}}
|
||||
\def\numpf@spf@lignlb@@[#1]{\ifnum0=`{\fi \iffalse}\fi
|
||||
&\numpf@lign@mklbl\math@cr@@@
|
||||
\noalign{\vskip#1\relax}%
|
||||
\refstepcounter{enum\romannumeral\the\@enumdepth}%
|
||||
&\numpf@mknum{\linenum}&}
|
||||
\def\numpf@spf@lignlb@star{%
|
||||
\new@ifnextchar[\numpf@spf@lignlb@@star{\numpf@spf@lignlb@@star[\z@]}}
|
||||
\def\numpf@spf@lignlb@@star[#1]{\ifnum0=`{\fi \iffalse}\fi
|
||||
\numpf@lign@mklbl\math@cr@@@
|
||||
\noalign{\vskip#1\relax}%
|
||||
\refstepcounter{enum\romannumeral\the\@enumdepth}%
|
||||
&\numpf@mknum{\linenum}&}
|
||||
|
||||
|
||||
% This should store the current way to show the line number,
|
||||
% wherever the command is.
|
||||
% It should also step the counter.
|
||||
% Currently, it only works for pfaligned.
|
||||
\newcommand{\numpf@shownum}{}
|
||||
\newcommand{\numpf@shownum@backup}{}
|
||||
\newcommand{\skippfnum}{%
|
||||
\global\let\numpf@shownum@backup\numpf@shownum
|
||||
\global\def\numpf@shownum
|
||||
{\global\let\numpf@shownum\numpf@shownum@backup}}
|
||||
|
||||
% If needed, one can adjust \minalignsep before pfaligned, as in
|
||||
% \renewcommand\minalignsep{4cm}
|
||||
% \jot in pfaligned is by default can set to 0pt.
|
||||
% To change it back (locally), use
|
||||
% \pfalignedjot=\jot
|
||||
% \label's must be put at the beginning of the lines.
|
||||
\newlength{\pfalignedjot}
|
||||
\setlength{\pfalignedjot}{0pt}
|
||||
% The only difference between the beamer and the non-beamer versions
|
||||
% is the overlay option.
|
||||
\@ifclassloaded{beamer}{%
|
||||
\newenvironment<>{pfaligned}[1]
|
||||
{\def\numpf@pf@ligned@txt{#1}%
|
||||
\def\numpf@pf@ligned@overlay{#2}%
|
||||
\collect@body\pfaligned@@}
|
||||
{\ignorespacesafterend}
|
||||
\newcommand{\pfaligned@@}[1]{%
|
||||
\let\numpf@amsmathLet@\Let@
|
||||
\def\Let@{\let\\\numpf@pf@lignedlb}%
|
||||
\expandafter\onslide\numpf@pf@ligned@overlay{\pfln
|
||||
\renewcommand{\numpf@shownum}{%
|
||||
\refstepcounter{enum\romannumeral\the\@enumdepth}%
|
||||
\hspace{-\labelwidth}\hspace{-\labelsep}%
|
||||
\numpf@mknum@norm{\linenum}}%
|
||||
\makebox[\linewidth][l]{\begin{math}\jot\pfalignedjot\begin{aligned}[t]
|
||||
% Hopefully no one uses \Let@ except amsmath.
|
||||
\global\let\Let@\numpf@amsmathLet@
|
||||
&\text{\numpf@pf@ligned@txt}%
|
||||

|
||||
\end{aligned}\end{math}}}\vspace{\pfalignedjot}}
|
||||
}{%
|
||||
\newenvironment{pfaligned}[1]
|
||||
{\def\numpf@pf@ligned@txt{#1}%
|
||||
\collect@body\pfaligned@@}{\ignorespacesafterend}
|
||||
\newcommand{\pfaligned@@}[1]{%
|
||||
\let\numpf@amsmathLet@\Let@
|
||||
\def\Let@{\let\\\numpf@pf@lignedlb}%
|
||||
\pfln
|
||||
\renewcommand{\numpf@shownum}{%
|
||||
\refstepcounter{enum\romannumeral\the\@enumdepth}%
|
||||
\hspace{-\labelwidth}\hspace{-\labelsep}%
|
||||
\numpf@mknum@norm{\linenum}}%
|
||||
\makebox[\linewidth][l]{\begin{math}\jot\pfalignedjot\begin{aligned}[t]
|
||||
% Hopefully no one uses \Let@ except amsmath.
|
||||
\global\let\Let@\numpf@amsmathLet@
|
||||
&\text{\numpf@pf@ligned@txt}%
|
||||

|
||||
\end{aligned}\end{math}}\vspace{\pfalignedjot}}
|
||||
}
|
||||
% The starred version has one fewer ampersand after the line break.
|
||||
% Modified from amsmath.sty, especially \math@cr
|
||||
\def\numpf@pf@lignedlb{\relax\iffalse{\fi\ifnum0=`}\fi
|
||||
\@ifstar{\numpf@pf@lignedlb@star}{\numpf@pf@lignedlb@}}
|
||||
\def\numpf@pf@lignedlb@{%
|
||||
\new@ifnextchar[\numpf@pf@lignedlb@@{\numpf@pf@lignedlb@@[\z@]}}
|
||||
\def\numpf@pf@lignedlb@@[#1]{\ifnum0=`{\fi \iffalse}\fi
|
||||
\math@cr@@@
|
||||
\noalign{\vskip#1\relax}%
|
||||
&\numpf@shownum&%
|
||||
\edef\@currentlabel
|
||||
{\csname p@enum\romannumeral\the\@enumdepth\endcsname
|
||||
\csname theenum\romannumeral\the\@enumdepth\endcsname}}
|
||||
\def\numpf@pf@lignedlb@star{%
|
||||
\new@ifnextchar[\numpf@pf@lignedlb@@star{\numpf@pf@lignedlb@@star[\z@]}}
|
||||
\def\numpf@pf@lignedlb@@star[#1]{\ifnum0=`{\fi \iffalse}\fi
|
||||
\math@cr@@@
|
||||
\noalign{\vskip#1\relax}%
|
||||
&\numpf@shownum%
|
||||
\edef\@currentlabel
|
||||
{\csname p@enum\romannumeral\the\@enumdepth\endcsname
|
||||
\csname theenum\romannumeral\the\@enumdepth\endcsname}}
|
||||
|
||||
% !!! dangerous bend !!!
|
||||
% Partly from https://tex.stackexchange.com/a/541683
|
||||
% One left-aligned column is always added at the beginning and
|
||||
% one right-aligned column is always added at the end.
|
||||
% Best used with \extracolsep plus \stretch{<factor>} or \fill.
|
||||
% To temporarily get rid of the added stretchable space,
|
||||
% issue \extracolsep{0pt}.
|
||||
\newcommand{\numpf@rray}[1]{%
|
||||
\tabto{\CurrentLineWidth}%
|
||||
\begin{math}\everymath={\displaystyle}%
|
||||
\let\ltx@label\label
|
||||
\let\label\numpf@rray@label
|
||||
\setlength{\numpf@templen}{\linewidth}%
|
||||
\addtolength{\numpf@templen}{-\TabPrevPos}%
|
||||
% Modified from array and tabular* in latex.ltx
|
||||
\setlength\dimen@{\numpf@templen}%
|
||||
\let\@acol\@arrayacol
|
||||
\let\@classz\@arrayclassz
|
||||
\let\@classiv\@arrayclassiv
|
||||
\let\\\numpf@rraylb
|
||||
\edef\@halignto{to\the\dimen@}\@tabarray[t]
|
||||
{@{}l@{\extracolsep{\fill}}#1@{\extracolsep{\fill}}r@{}}}
|
||||
% The starred form removes the ampersand before the line break.
|
||||
\def\numpf@rraylb{\relax\iffalse{\fi\ifnum0=`}\fi
|
||||
\@ifstar{\numpf@rraylb@star}{\numpf@rraylb@}}%
|
||||
\def\numpf@rraylb@{%
|
||||
\new@ifnextchar[\numpf@rraylb@@{\numpf@rraylb@@[\z@]}%
|
||||
}
|
||||
\def\numpf@rraylb@@[#1]{\ifnum0=`{\fi \iffalse}\fi
|
||||
&\@arraycr[#1]%
|
||||
\refstepcounter{enum\romannumeral\the\@enumdepth}%
|
||||
\hspace{-\labelwidth}\hspace{-\labelsep}%
|
||||
\numpf@mknum@norm{\linenum}}
|
||||
\def\numpf@rraylb@star{%
|
||||
\new@ifnextchar[\numpf@rraylb@@star{\numpf@rraylb@@star[\z@]}%
|
||||
}
|
||||
\def\numpf@rraylb@@star[#1]{\ifnum0=`{\fi \iffalse}\fi
|
||||
\@arraycr[#1]%
|
||||
\refstepcounter{enum\romannumeral\the\@enumdepth}%
|
||||
\hspace{-\labelwidth}\hspace{-\labelsep}%
|
||||
\numpf@mknum@norm{\linenum}}
|
||||
\def\numpf@rray@label#1{%
|
||||
\edef\@currentlabel
|
||||
{\csname p@enum\romannumeral\the\@enumdepth\endcsname
|
||||
\csname theenum\romannumeral\the\@enumdepth\endcsname}%
|
||||
\ltx@label{#1}}
|
||||
|
||||
% You may find \popqed and \qedhere helpful.
|
||||
|
||||
% To do
|
||||
% - keyval list of options to control, say, spacing.
|
||||
% - option to omit numbering for one line via \skippfnum
|
||||
% for other environments
|
||||
% - take care of itemize in addition to enumerate.
|
||||
\endinput
|
BIN
cheatsheets/cs1231s/cheatsheet.pdf
Normal file
BIN
cheatsheets/cs1231s/cheatsheet.pdf
Normal file
Binary file not shown.
1107
cheatsheets/cs1231s/cheatsheet.tex
Normal file
1107
cheatsheets/cs1231s/cheatsheet.tex
Normal file
File diff suppressed because it is too large
Load Diff
BIN
cheatsheets/cs1231s/finals.pdf
Normal file
BIN
cheatsheets/cs1231s/finals.pdf
Normal file
Binary file not shown.
1188
cheatsheets/cs1231s/finals.tex
Normal file
1188
cheatsheets/cs1231s/finals.tex
Normal file
File diff suppressed because it is too large
Load Diff
BIN
cheatsheets/cs1231s/midterms.pdf
Normal file
BIN
cheatsheets/cs1231s/midterms.pdf
Normal file
Binary file not shown.
917
cheatsheets/cs1231s/midterms.tex
Normal file
917
cheatsheets/cs1231s/midterms.tex
Normal file
@ -0,0 +1,917 @@
|
||||
\documentclass[a4paper]{article}
|
||||
\usepackage{amsmath}
|
||||
\usepackage{amsthm}
|
||||
\usepackage{amssymb}
|
||||
|
||||
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{textcomp}
|
||||
\usepackage{url}
|
||||
% \usepackage{subcaption}
|
||||
\usepackage{emptypage}
|
||||
% \usepackage{multicol}
|
||||
\usepackage{cancel}
|
||||
\usepackage{mathtools}
|
||||
|
||||
\usepackage{lscape}
|
||||
\usepackage{pdflscape}
|
||||
|
||||
\usepackage{float}
|
||||
|
||||
|
||||
\usepackage{xifthen}
|
||||
\usepackage[skip=10pt]{parskip}
|
||||
|
||||
\usepackage{comment}
|
||||
\usepackage[margin=0.5in]{geometry}
|
||||
\setlength{\parindent}{0pt}
|
||||
|
||||
\usepackage{1231num}
|
||||
|
||||
\theoremstyle{definition}
|
||||
\newtheorem*{defn}{Defn}
|
||||
|
||||
\newtheorem*{propos}{Proposition}
|
||||
|
||||
\renewcommand{\qedsymbol}{}
|
||||
|
||||
\newtheorem{innertheorem}{Theorem}
|
||||
\newenvironment{theorem}[1]
|
||||
{\renewcommand\theinnertheorem{#1}\innertheorem}
|
||||
{\endinnertheorem}
|
||||
|
||||
|
||||
\author{Yadunand Prem}
|
||||
|
||||
\title{Midterms Cheatsheet}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\section{Math}
|
||||
|
||||
\begin{defn}{Even and Odd Integers}\\
|
||||
n is even $\Leftrightarrow \exists$ an integer $k$ s.t. $n = 2k$\\
|
||||
n is odd $\Leftrightarrow \exists$ an integer $k$ s.t. $n = 2k + 1$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}{Divisibility}\\
|
||||
$n$ and $d$ are integers and $d \not= 0$ \\
|
||||
$d | n \Leftrightarrow \exists k \in \mathbb{Z}$ s.t. $n = dk$
|
||||
\end{defn}
|
||||
|
||||
\begin{theorem}{4.2.1}
|
||||
Every Integer is a rational number
|
||||
\end{theorem}
|
||||
|
||||
\begin{theorem}{4.2.2}
|
||||
The sum of any two rational numbers is rational
|
||||
\end{theorem}
|
||||
|
||||
\begin{theorem}{4.3.1}
|
||||
For all $a, b \in \mathbb{Z}^+$, if $a | b$, then $a \leq b$
|
||||
\end{theorem}
|
||||
\begin{theorem}{4.3.2}
|
||||
Only divisors of $1$ are $1$ and $-1$
|
||||
\end{theorem}
|
||||
\begin{theorem}{4.3.3}
|
||||
$\forall a, b, c \in \mathbb{Z}$ if $a | b$, $b | c$, $a | c$
|
||||
\end{theorem}
|
||||
\begin{theorem}{4.6.1}
|
||||
There is no greatest integer
|
||||
\end{theorem}
|
||||
\begin{propos}{4.6.4}
|
||||
For all integers $n$, if $n^2$ is even, then $n$ is even.
|
||||
\end{propos}
|
||||
|
||||
\begin{defn}{Rational}
|
||||
$r$ is rational $\Leftrightarrow \exists a, b \in \mathbb{Z}$ s.t. $r = \frac{a}{b}$ and $b \not=0$
|
||||
\end{defn}
|
||||
\begin{defn}{Fraction in lowest term:}
|
||||
fraction $\frac{a}{b}$ is lowest term if largest $\mathbb{Z}$ that divies both $a$ and $b$ is 1
|
||||
\end{defn}
|
||||
|
||||
\begin{theorem}{4.7.1}
|
||||
$\sqrt{2}$ is irrational
|
||||
\end{theorem}
|
||||
|
||||
|
||||
\section{Logic of Combound Statements}
|
||||
|
||||
\begin{theorem}{3.2.1} Negation of universal stmt
|
||||
$\sim(\forall x \in D, P(x)) \equiv \exists x \in D$ s.t. $\sim P(x)$
|
||||
\end{theorem}
|
||||
\begin{theorem}{3.2.1} Negation of existential stmt
|
||||
$\sim(\exists x \in D$ s.t. $P(x)) \equiv \forall x \in D, \sim P(x)$
|
||||
\end{theorem}
|
||||
|
||||
\begin{defn}{Contrapositive}
|
||||
of $p \Rightarrow q \equiv \sim q \Rightarrow p$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}{Converse}
|
||||
of $p \Rightarrow q$ is $q \Rightarrow p$
|
||||
\end{defn}
|
||||
\begin{defn}{Inverse}
|
||||
of $p \Rightarrow q$ is $\sim p \Rightarrow \sim q$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}{Only if:}
|
||||
$p$ only if $q$ means $\sim q \Rightarrow \sim p \equiv p \Rightarrow q$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}{Biconditional:}
|
||||
$p \Leftrightarrow q \equiv (p \Rightarrow q) \land (q \Rightarrow p)$
|
||||
\end{defn}
|
||||
\begin{defn}
|
||||
$r$ is sufficient condition for $s$ means if $r$ then $s$, $r \Rightarrow s$
|
||||
\end{defn}
|
||||
\begin{defn}
|
||||
$r$ is necessary condition for $s$ means if $\sim r$ then $\sim s$, $s \Rightarrow r$
|
||||
\end{defn}
|
||||
|
||||
|
||||
\begin{defn}{Proof by Contradiction}\\
|
||||
If you can show that the supposition that sttatement $p$ is false leads to a contradiction, then you can conclude that $p$ is true
|
||||
\end{defn}
|
||||
|
||||
\section{Methods of Proof}
|
||||
|
||||
\begin{tabular} {|c|l|}
|
||||
\hline
|
||||
Statement & Proof Approach \\
|
||||
$\forall x \in D\ P(X)$ & Direct: Pick arbitrary x, prove P is true for that x. \\
|
||||
& Contradiction: Suppose not, i.e. $ \exists x(\sim p)$... Hence supposition $\sim p$ is false (P3) \\
|
||||
\hline
|
||||
$\exists x \in D\ P(X)$ & Direct: Find x where P is true. \\
|
||||
& Contradiction: Suppose not, i.e. $\forall x (\sim p)$... Hence supposition $\sim p$ is false (P3) \\
|
||||
\hline
|
||||
$P \Rightarrow Q$ & Direct: Assume P is true, prove Q \\
|
||||
& Contradiction: Assume P is true and Q is false, then derive contradiction \\
|
||||
& Contrapositive: Assume $\sim Q$, then prove $\sim P$ \\
|
||||
\hline
|
||||
$P \Leftrightarrow Q$ & Prove both $P \Rightarrow Q$ and $Q \Rightarrow P$ \\
|
||||
\hline
|
||||
$xRy$. Prove R is equivalence & Prove Reflexive, Symmetric and Transitive \\
|
||||
\hline
|
||||
Reflexive & \\
|
||||
\hline
|
||||
Symmetric & \\
|
||||
\hline
|
||||
Antisymmetric & \\
|
||||
\hline
|
||||
Transitive & \\
|
||||
\hline
|
||||
|
||||
|
||||
\end{tabular}
|
||||
|
||||
\begin{defn}{Proof by Contraposition}\\
|
||||
1. Statement to be proved $\forall x \in D\ (P(x) \Rightarrow Q(x))$\\
|
||||
2. Contrapositive Form: $\forall x \in D\ (\sim Q(x) \Rightarrow \sim P(x))$\\
|
||||
3. Prove by direct proof\\
|
||||
3.1 Suppose x is an element of D s.t. $Q(X)$ is false\\
|
||||
3.2 Show that P(x) is false.\\
|
||||
4. Therefore, original statement is true
|
||||
\end{defn}
|
||||
|
||||
|
||||
\section{Set Theory}
|
||||
|
||||
\begin{defn}{Set: Unordered collection of objects}\\
|
||||
Order and duplicates don't matter
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}{Membership of Set $\in$: }
|
||||
If $S$ is set, $x \in S$ means $x$ is an element of $S$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}{Cardinality of Set $|S|$: }
|
||||
The number of elements in $S$
|
||||
\end{defn}
|
||||
|
||||
Common Sets:
|
||||
|
||||
$\mathbb{N}$ - Natural Numbers, $\{0, 1, 2\}$
|
||||
|
||||
$\mathbb{Z}$ - Integers
|
||||
|
||||
$\mathbb{Q}$ - Rational
|
||||
|
||||
$\mathbb{R}$ - Real
|
||||
|
||||
$\mathbb{C}$ - Complex
|
||||
|
||||
$\mathbb{Z}^\pm$ - Positive/Negative Integers
|
||||
|
||||
\begin{defn}{Subset}
|
||||
$A \subseteq B \Leftrightarrow$ Every element of $A$ is also an element of $B$\\
|
||||
$A \subseteq B \Leftrightarrow \forall x(x\in A \Rightarrow x \in B)$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}{Proper Subset}
|
||||
$A \subsetneq B \Leftrightarrow (A \subseteq B \land A \not = B)$
|
||||
\end{defn}
|
||||
|
||||
\begin{theorem}{6.2.4}
|
||||
An empty set is a subset of every set, i.e. $\emptyset \subseteq A$ for all sets $A$
|
||||
\end{theorem}
|
||||
|
||||
\begin{defn}{Cartesian Product}
|
||||
$A \times B = \{(a, b): a \in A \land b \in B\} $
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}{Set Equality}
|
||||
$A = B \Leftrightarrow A \subseteq B \land B \subseteq A$ \\
|
||||
$A = B \Leftrightarrow \forall x (x \in A \Leftrightarrow x \in B)$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}{Union:}
|
||||
$A \cup B = \{x \in U: x \in A \lor x \in B\}$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}{Intersection:}
|
||||
$A \cap B = \{x \in U: x \in A \land x \in B\}$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}{Difference:}
|
||||
$B \setminus A = \{x \in U: x \in B \land x \not\in A\}$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}{Disjoint:}
|
||||
$A \cap B = \emptyset$
|
||||
\end{defn}
|
||||
|
||||
\begin{theorem}{4.4.1} Quotient-Remainder
|
||||
$n \in \mathbb{Z}, d \in \mathbb{Z}^+$\\ there exists unique integers q and r such that $n = dq + r$ and $0 \leq r < d$
|
||||
\end{theorem}
|
||||
|
||||
\begin{defn}{Power Set:}
|
||||
The set of all subsets of $A$, has $2^n$ elements.
|
||||
\end{defn}
|
||||
|
||||
\begin{theorem}{6.3.1}
|
||||
Suppose $A$ is a finite set with $n$ elements, then $P(A)$ has $2^n$ elements.
|
||||
$|P(A)| = 2^{|n|}$
|
||||
\end{theorem}
|
||||
|
||||
\begin{defn}{Cartesian Product of $A_n$}
|
||||
$= A_1 \times A_2 \times ... \times A_n = \{(a_1, a_2,...a_n): a_1 \in A_1 \land a_2 \in A_2...$
|
||||
\end{defn}
|
||||
|
||||
\begin{theorem}{6.2.1} Subset Relations
|
||||
\begin{numpf*}
|
||||
\pfln Inclusion of Intersection: $A \cup B \subseteq A, A \cup B \subseteq B$
|
||||
\pfln Inclusion in Union $A \subseteq A \cup B, B \subseteq A \cup B$
|
||||
\pfln Transitive Property of Substs: $A \subseteq B \land B \subseteq C \Rightarrow A \subseteq C$
|
||||
\end{numpf*}
|
||||
\end{theorem}
|
||||
|
||||
\section{Relations}
|
||||
|
||||
\begin{defn} Relation from A to B is a subset of $A \times B$\\
|
||||
Given an ordered pair$(x, y) \in A\times B$, $x$ is
|
||||
related to y by $R$ is written $xRy \Leftrightarrow (x, y) \in R$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn} Domain, Co-domain, Range\\
|
||||
Let $A$ and $B$ be sets and $R$ be a relation from $A$ to $B$
|
||||
\begin{numpf*}
|
||||
\pfln Domain of R: is set $\{a \in A: aRb$ for some $b \in B\}$
|
||||
\pfln Codomain of R: Set B
|
||||
\pfln Range of R: is set $\{b \in B: aRb$ for some $a \in A\}$
|
||||
\end{numpf*}
|
||||
\end{defn}
|
||||
|
||||
\begin{defn} Inverse Relation\\
|
||||
Let $R$ be a relation from $A$ to $B$,
|
||||
$R^{-1} = \{(y, x) \in B\times A: (x, y) \in R\}$\\
|
||||
$\forall x \in A, \forall y \in B ((y, x) \in R^{-1} \Leftrightarrow (x, y) \in R)$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}
|
||||
Relation on a Set $A$ is a relation from $A$ to $A$.
|
||||
\end{defn}
|
||||
|
||||
\begin{defn} Composition of Relations\\
|
||||
A, B and C be sets. $R \subseteq A \times B$ be a relation. $S \subset B \times C$ be relation. Composition of R with S, denoted $S \circ R$ is relation from A to C such that: \\
|
||||
$\forall x \in A, \forall z \in C(x S \circ R z \Leftrightarrow (\exists y \in B (xRy \land ySz)))$
|
||||
\end{defn}
|
||||
|
||||
\begin{propos} Composition is Associative
|
||||
$A, B, C, D$ be sets. $R \subseteq A \times B$, $S \subseteq B \times C$, $T \subseteq C \times D$\\
|
||||
$T \circ ( S \circ R) = T \circ S \circ R$
|
||||
\end{propos}
|
||||
|
||||
\begin{propos} Inverse of Composition
|
||||
$A, B, C$ be sets. $R \subseteq A \times B$, $S \subseteq B \times C$\\
|
||||
$(S \circ R)^{-1} = R^{-1} \circ S^{-1}$
|
||||
\end{propos}
|
||||
|
||||
\begin{defn} \textbf{Reflexivity, Symmetry, Transitivity}
|
||||
\begin{numpf*}
|
||||
\pfln Reflexivity: $\forall x \in A (xRx)$
|
||||
\pfln Symmetry: $\forall x,y \in A (xRy \Rightarrow yRx)$
|
||||
\pfln Transitivity:$\forall x,y,z \in A (xRy \land yRz \Rightarrow xRz)$
|
||||
\end{numpf*}
|
||||
Refer to proof 6
|
||||
\end{defn}
|
||||
|
||||
\begin{defn} Transitive Closure\\
|
||||
Transitive closure of R is relation $R^t$ on A that satiesfies
|
||||
\begin{numpf*}
|
||||
\pfln $R^t$ is transitive
|
||||
\pfln $R \subseteq R^t$
|
||||
\pfln If $S$ is any other transitive relation that contains $R$, then $R^t \subseteq S$
|
||||
\end{numpf*}
|
||||
\end{defn}
|
||||
|
||||
\begin{defn} Partition\\
|
||||
$P$ is partition of set A if
|
||||
\begin{numpf*}
|
||||
\pfln $P$ is a set of which all elements are non empty subsets of A, $\emptyset \not = S \subseteq A$ for all $S \in P$
|
||||
\pfln Every element of $A$ is in exactly on element of P, \\
|
||||
$\forall x \in A\ \exists S \in P (x \in S)$ and \\
|
||||
$\forall x \in A\ \exists S_1, S_2 \in P(x \in S_1 \land x \in S_2 \Rightarrow S_1 = S_2)$
|
||||
\end{numpf*}
|
||||
OR $\forall x \in A\ \exists!S \in P(x \in S)$\\
|
||||
Elements of a partition are called components
|
||||
\end{defn}
|
||||
|
||||
\begin{defn} Relation Induced by a partition\\
|
||||
Given partition $P$ of $A$, the relation $R$ induced by partition: \\
|
||||
$\forall x, y \in A, xRy \Rightarrow \exists$ a component of $S$ of $P$ s.t. $x, y \in S$
|
||||
\end{defn}
|
||||
|
||||
\begin{theorem}{8.3.1}[Relation Induced by a Partition]
|
||||
Let $A$ be a set with a partition and let R be a relation induced by the partition. Then $R$ is reflexive, symmetric and transitive
|
||||
\end{theorem}
|
||||
|
||||
\begin{defn}[Equivalence Relation]
|
||||
$A$ be set and $R$ be relation. $R$ is equivalence relation iff $R$ is reflexive, symmetric and transitive
|
||||
\end{defn}
|
||||
|
||||
\begin{defn} Equivalence Class\\
|
||||
Suppose $A$ is set and $\sim$ is equivalence relation on A. For each $A \in A$, equivalence class of $a$, denoted $[a]$ and called class of $a$ is set of all elements $x \in A$ s.t. $a\sim x$\\
|
||||
$[a]_{\sim} = \{x \in A: a \sim x \}$
|
||||
\end{defn}
|
||||
|
||||
\begin{theorem}{8.3.4} The partition induced by an Equivalence Relation\\
|
||||
If $A$ is a set and $R$ is an equivalence relation on $A$, then distinct equivalence classes of $R$ form a partition of $A$; that is, the union of the equivalence classes is all of $A$, and the intersection of any 2 disctinct classes is empty.
|
||||
\end{theorem}
|
||||
|
||||
\begin{defn} Congruence\\
|
||||
Let $a, b \in \mathbb{Z}$ and $n \in \mathbb{Z}^+$. Then $a$ is congruent to $b$ modulo $n$ iff $a - b = nk$, for some $k \in \mathbb{Z}$. In other words, $n | (a - b)$. We write $a \equiv b (\text{mod}\ n)$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn} Set of equivalence classes\\
|
||||
Let $A$ be set and $\sim$ be an equivalence relation on $A$. Denote by $A/\sim$, the set of all equivalence classes with respect to $\sim$, i.e.
|
||||
|
||||
$A/\sim = \{[x]_\sim: x \in A\}$
|
||||
\end{defn}
|
||||
|
||||
\begin{theorem}{Equivalence Classes} form a partition
|
||||
Let $\sim$ be an equiv. relation on $A$. Then $A/\sim$ is a partition of A.
|
||||
\end{theorem}
|
||||
|
||||
\begin{defn}[Antisymmetry]
|
||||
$R$ is antisymmetric iff $\forall x, y \in A(xRy \land yRx \Rightarrow x = y)$ \textit{(DOES NOT IMPLY NOT SYMMETRIC)}
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}[Partial Order Relation]
|
||||
$R$ is Partial Order iff R is \textit{reflexive}, \textit{antisymmetric} and \textit{transitive}.
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}{Partially Ordered Set}
|
||||
Set A is called poset with respect to partial order relation $R$ on $A$, denoted by $(A, R)$ (Proof 7)
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}{$x \preccurlyeq y$}
|
||||
is used as a general partial order relation notation
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}[Hasse Diagram]
|
||||
Let $\preccurlyeq$ be a partial order on set $A$. Hasse diagram satisfies the following condition for all distinct $x, y, m \in A$ \\
|
||||
If $x \preccurlyeq y$ and no $m \in A$ is s.t. $x \preccurlyeq m \preccurlyeq y$, then x is placed below y with a line joining them, else no line joins $x$ and $y$.
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}[Comparability]
|
||||
$a, b \in A$ are comparable iff $a \preccurlyeq b$ or $b \preccurlyeq a$. Otherwise, they are \textbf{noncomparable}
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}[Maximal, Minimal, Largest Smallest]
|
||||
Set $A$ be partially ordered w.r.t. a relation $\preccurlyeq$ and $c \in A$
|
||||
\begin{numpf}
|
||||
\pfln c is maximal element of $A$ iff $\forall x \in A$, either $x \preccurlyeq c$ or $x$ and $c$ are non-comparable. OR $\forall x in A(c \preccurlyeq x \Rightarrow c = x)$
|
||||
\pfln c is minimal element of $A$ iff $\forall x \in A$, either $c \preccurlyeq x$ or $x$ and $c$ are non-comparable. OR $\forall x in A(x \preccurlyeq c \Rightarrow c = x)$
|
||||
\pfln c is largest element of $A$ iff $\forall x \in A (x \preccurlyeq c)$
|
||||
\pfln c is smallest element of $A$ iff $\forall x \in A (c \preccurlyeq x)$
|
||||
\end{numpf}
|
||||
\end{defn}
|
||||
|
||||
\begin{propos} A smallest element is minimal\\
|
||||
Consider a partial order $\preccurlyeq$ on set $A$. Any smallest element is minimal.
|
||||
\begin{numpf}
|
||||
\pfln Let $c$ be smallest elemnt
|
||||
\pfln Take any $x \in A$ s.t. $x \preccurlyeq c$
|
||||
\pfln By smallestness, we know $c \preccurlyeq x$ too.
|
||||
\pfln So $c = x$ by antisymmetry
|
||||
\end{numpf}
|
||||
\end{propos}
|
||||
|
||||
\begin{defn}[Total Order Relations] All elements of the set are comparable\\
|
||||
R is total order iff $R$ is a partial order and $\forall x, y \in A (xRy \lor yRx)$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}[Linearization of a partial order]
|
||||
Let $\preccurlyeq$ be a partial order on set $A$. A linearization of $\preccurlyeq$ is a total order $\preccurlyeq *$ on $A$ s.t. $\forall x, y \in A (x \preccurlyeq y \Rightarrow x \preccurlyeq *\ y)$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}[Kahn's Algorithm]
|
||||
Input: A finite set $A$ and partial order $\preccurlyeq$ on $A$
|
||||
\begin{numpf}
|
||||
\pfln Set $A_0 := A$ and $i := 0$
|
||||
\pfln Repeat until $A_i = \emptyset$
|
||||
\begin{subpf}
|
||||
\pfln Find minimal element $c_i$ of $A_i$ wrt $\preccurlyeq$
|
||||
\pfln Set $A_{i+1} = A_i \setminus {c_i}$
|
||||
\pfln Set $i = i+1$
|
||||
\end{subpf}
|
||||
\end{numpf}
|
||||
|
||||
Output: A linearization $\preccurlyeq *$ of $\preccurlyeq$ defined by setting, for all indicies $i, j$\\ $c_i \preccurlyeq*\ c_j \Leftrightarrow i \leq j$
|
||||
\end{defn}
|
||||
|
||||
\begin{defn}[Well ordered set] Let $\preccurlyeq$ be a total order on set $A$. $A$ is well ordered iff every nonempty subset of A contains a smallest element. OR\\
|
||||
$\forall S \in P(A), S \not = \emptyset \Rightarrow (\exists x \in S \forall y \in S (x \preccurlyeq y))$ E.g. $(\mathbb{N}, \leq)$ is well ordered but $(\mathbb{Z}, \leq)$ is not as there is no smallest integer (Theorem 4.6.1)
|
||||
|
||||
\end{defn}
|
||||
|
||||
\section{Proofs}
|
||||
|
||||
\begin{proof} [\proofname\ L1S28]
|
||||
Prove that the product of two consecutive odd numbers is always odd.
|
||||
\begin{numpf*}
|
||||
\pfln Let $a$ and $b$ be two consecutive odd numbers
|
||||
\begin{subpf*}
|
||||
\pfln Without loss of generality, assume that $a < b$, hence $b = a + 2$
|
||||
\pfln Now, $a = 2k+1$ (by defn of odd numbers)
|
||||
\pfln Similarly, $b = a + 2 = 2k + 3$
|
||||
\pfln Therefore, $ab = (2k+1)(2k+3) = (4k^2 + 6k) + (2k + 3) = 4k^2 + 8k + 3 = 2(2k^2 + 4k + 1) + 1$ (by Basic Algebra)
|
||||
\pfln Let $m = (2k^2 + 4k + 1)$ which is an integer (by closure of integers under $\times$ and $+$)
|
||||
\pfln Then $ab = 2m + 1$ which is odd (by defn of odd numbers)
|
||||
\end{subpf*}
|
||||
\pfln Therefore, the product of two consecutive odd numbers is always odd.
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
|
||||
\begin{proof}[\proofname\ L4S16] Sum of 2 even $\mathbb{Z}$ is even
|
||||
\begin{numpf*}
|
||||
\pfln Let m and n be two particular but arbitrarily chosen even intergers
|
||||
\begin{subpf*}
|
||||
\pfln Then $m = 2r$ and $n = 2s$ for some $\mathbb{Z}$ $r$ and $s$ (by defn of even number)
|
||||
\pfln $m + n = 2r + 2s = 2(r+s)$ (by basic algebra)
|
||||
\pfln 2(r+s) is an integer(closure of int under $\times$ and $+$) and an even number (by defn of even number)
|
||||
\pfln Hence $m+n$ is an even number
|
||||
\end{subpf*}
|
||||
\pfln Therefore sum of any two even integers is even
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
|
||||
\begin{proof}[\proofname\ T 4.6.1] There is no greatest integer (Contradiction)
|
||||
\begin{numpf*}
|
||||
\pfln Suppose not, i.e. there is a greatest intger
|
||||
\begin{subpf*}
|
||||
\pfln Lets call this greatest integer g, and $g \geq n$ for all integers n
|
||||
\pfln Let $G = g + 1$
|
||||
\pfln Now, $G$ is an integer (closure of integers under $+$) and $G > g$
|
||||
\pfln Hence, g is not the greatest integer, contradicting 1.1
|
||||
\end{subpf*}
|
||||
\pfln Hence, the supposition that there is a greatest integer is false.
|
||||
\pfln Therefore there is no greatest integer
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
\begin{proof}[\proofname\ L5S19] L5S19 Two sets are equal
|
||||
\begin{numpf*}
|
||||
\pfln Let sets $X$ and $Y$ be given. To prove $X$ = $Y$
|
||||
\pfln ($\subseteq$) Prove $X \subseteq Y$
|
||||
\pfln ($\supseteq$) Prove $X \supseteq Y$
|
||||
\pfln From (2) and (3), we can conclude that $X = Y$
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
|
||||
\begin{proof}[\proofname\ L5S22] L5S22 $\{x \in Z: x^2 = 1\} = \{1, -1\}$
|
||||
\begin{numpf*}
|
||||
\pfln $\rightarrow$
|
||||
\begin{subpf*}
|
||||
\pfln Take any $z \in \{x \in \mathbb{Z} : x^2 = 1\}$
|
||||
\pfln Then $z \in \mathbb{Z}$ and $z^2 = 1$
|
||||
\pfln So, $z^2 -1 = (z-1)(z+1) = 0$ (by basic algebra)
|
||||
\pfln $\therefore$ $z-1 = 0$ or $z +1 = 0$
|
||||
\pfln $\therefore$ $z = 1$ or $z = -1$
|
||||
\pfln So, $z \in \{1, -1\}$
|
||||
\end{subpf*}
|
||||
\pfln $\leftarrow$
|
||||
\begin{subpf*}
|
||||
\pfln Take any $z \in \{1, -1\}$
|
||||
\pfln Then $z = 1$ or $z=-1$
|
||||
\pfln In either case, we have $z \in \mathbb{Z}$ and $z^2 = 1$
|
||||
\pfln So, $z \in \{x \in \mathbb{Z} : x^2 = 1\}$
|
||||
\end{subpf*}
|
||||
\pfln Therefore, $\{x \in Z: x^2 = 1\} = \{1, -1\}$ (from (1) and (2))
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
|
||||
\begin{proof}[\proofname\ L6S27] $\forall x,y \in \mathbb{Z} (xRy \Leftrightarrow 3 | (x-y))$ is reflexive, symmetric, transitive
|
||||
\begin{numpf*}
|
||||
\pfln Proof of Reflexivity
|
||||
\begin{subpf*}
|
||||
\pfln Let $a$ be an arbitrarily chosen integer.
|
||||
\pfln Now $a - a = 0$
|
||||
\pfln $3 | 0 $(since $ 0 = 3 \cdot 0)$, hence $3 |(a - a)$
|
||||
\pfln Therefore $aRa$ (by defn of R)
|
||||
\end{subpf*}
|
||||
\pfln Proof of Symmetry
|
||||
\begin{subpf*}
|
||||
\pfln Let a, b be arbitrarily chosen integers
|
||||
\pfln Then $3|(a-b)$ (by defn of R), hence $a-b = 3k$ for some integer k (by defn of divisibility)
|
||||
\pfln Multiplying both sides by $-1$ gives $b-a = 3(-k)$
|
||||
\pfln Since $-k$ is an integer, $3 | (b-a)$ (by defn of divisibility)
|
||||
\pfln Therefore, $aRb \Rightarrow bRa$ (by defn of R)
|
||||
\end{subpf*}
|
||||
\pfln Proof of Transitivity
|
||||
\begin{subpf*}
|
||||
\pfln Let a, b, c be arbitrarily chosen integers
|
||||
\pfln Then, $3 | (a - b)$ and $3 | (b - c)$ (by defn of R), hence $a-b = 3r$ and $b-c = 3s$ (by defn of divisiblity)
|
||||
\pfln Adding both equations gives $a - c = 3r + 3s$
|
||||
\pfln Since $r+s$ is an integer, $3 | (a - c)$ (by defn of divisiblity)
|
||||
\pfln Therefore $aRb \land bRc \Rightarrow aRc$ (by defn of R)
|
||||
\end{subpf*}
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
|
||||
\begin{proof}[Lemma Equivalence Class L6S47] Let $\sim$ be an equivalence relation on $A$. The following are equivalent for all $x, y \in A$ (i) $x\sim y$, (ii) $[x] = [y]$, (iii) $[x] \cap [y] \not = \emptyset$
|
||||
\begin{numpf*}
|
||||
\pfln $x \sim y \Rightarrow [x] = [y]$
|
||||
\begin{subpf*}
|
||||
\pfln Suppose $x \sim y$
|
||||
\pfln Then $y \sim x$ (by symmetry)
|
||||
\pfln For every $z \in [x]$
|
||||
\begin{subpf*}
|
||||
\pfln $x \sim z$ (by defn of x)
|
||||
\pfln $\therefore y \sim z$ (by transitivity of $y\sim x$)
|
||||
\pfln $\therefore z \in [y]$ (by defn of $[y]$)
|
||||
\end{subpf*}
|
||||
\pfln This shows $[x] \subseteq [y]$
|
||||
\pfln Switching roles of $x$ and $y$, we can also see that $[y] \subseteq [x]$
|
||||
\pfln Therefore, $[x] = [y]$
|
||||
\end{subpf*}
|
||||
\pfln $[x] = [y] \Rightarrow [x] \cap [y] \not = \emptyset$
|
||||
\begin{subpf*}
|
||||
\pfln Suppose $[x] = [y]$
|
||||
\pfln Then $[x] \cap [y] = [x]$ (by idempotent law for $\cap$)
|
||||
\pfln However, we know $x\sim x$ (by reflexivity of $\sim$)
|
||||
\pfln This shows $x \in [x] = [x] \cap [y]$ (by defn of [x] and (2.2))
|
||||
\pfln Therefore $[x] \cap [y] \not = \emptyset$
|
||||
\end{subpf*}
|
||||
\pfln $[x] \cap [y] \not = \emptyset \Rightarrow x \sim y$
|
||||
\begin{subpf*}
|
||||
\pfln Suppose $[x] \cap [y] \not = \emptyset$
|
||||
\pfln Take $z \in [x] \cap [y]$
|
||||
\pfln Then $z \in [x]$ and $z \in [y]$ (by defn of $\cap$)
|
||||
\pfln Then $x \sim z$ and $y \sim z$ (by defn of $[x]$ and $[y]$)
|
||||
\pfln $y \sim z$ implies $z \sim y$ (by defn of symmetry)
|
||||
\pfln Therefore, $x \sim y$ (by transitivity)
|
||||
\end{subpf*}
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
|
||||
\begin{proof}[Proposition L6S54] Congruence-mod $n$ is an equivalence relation on $\mathbb{Z}$ for every $n \in \mathbb{Z}^+$
|
||||
\begin{numpf*}
|
||||
\pfln (Reflexivity) For all $a \in \mathbb{Z}$
|
||||
\begin{subpf*}
|
||||
\pfln $a - a = 0 = n \times 0$
|
||||
\pfln So $a \equiv a (\text{mod}\ n)$ (by defn of congruence)
|
||||
\end{subpf*}
|
||||
\pfln (Symmetry)
|
||||
\begin{subpf*}
|
||||
\pfln Let $a, b \in \mathbb{Z}$ s.t. $a \equiv a (\text{mod}\ n)$
|
||||
\pfln Then there is a $k \in \mathbb{Z}$ s.t. $a - b = nk$
|
||||
\pfln Then $b - a = -(a - b) = -nk = n(-k)$
|
||||
\pfln $-k \in \mathbb{Z}$ (by closure of integers under $\times$), so $b \equiv a (\text{mod}\ n)$ (by defn of congruence)
|
||||
\end{subpf*}
|
||||
\pfln (Transitivity)
|
||||
\begin{subpf*}
|
||||
\pfln Let $a, b,c \in \mathbb{Z}$ s.t. $a \equiv a (\text{mod}\ n)$ and $b \equiv c (\text{mod}\ n)$
|
||||
\pfln Then there is a $k,l \in \mathbb{Z}$ s.t. $a - b = nk$ and $b - c = nl$
|
||||
\pfln Then $a - c = (a - b) + (b - c) = nk + nl = n(k + 1)$
|
||||
\pfln $k + l \in \mathbb{Z}$ (by closure of integers under $+$), so $a \equiv c (\text{mod}\ n)$ (by defn of congruence)
|
||||
\end{subpf*}
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
|
||||
\begin{proof}[\proofname\ L6S69] $\forall a, b \in \mathbb{Z}^+, \forall a | b \Leftrightarrow b = ka$ for some integer $k$. Prove $|$ is a partial order relation on $A$
|
||||
\begin{numpf*}
|
||||
\pfln $|$ is reflexive: Suppose $a \in A$. Then $a = 1 \dot a$, so $a|a$ (by defn of divisiblity)
|
||||
\pfln $|$ is antisymmetric
|
||||
\begin{subpf*}
|
||||
\pfln Suppose $a, b \in \mathbb{Z}^+$ such that $aRb$ and $bRa$
|
||||
\pfln Then $b = ra$ and $a = sb$ for some integers $r$ and $s$ (by defn of divides). It follows that $b = ra = r(sb)$
|
||||
\pfln Dividing both sides by $b$ gives $1 = rs$
|
||||
\pfln Only product of two positive integers that equals 1 is $1 \dot 1$.
|
||||
\pfln Thus $r = s = 1$, and so $a = sb = 1 \dot b = b$
|
||||
\pfln Therefore, $|$ is antisymmetric
|
||||
\end{subpf*}
|
||||
OR
|
||||
\begin{subpf*}
|
||||
\pfln Suppose $a, b \in \mathbb{Z}^+$ such that $a|b$ and $b|a$
|
||||
\pfln then $a \leq b$ and $b \leq a$ (by theorem 4.3.1)
|
||||
\pfln So $a = b$
|
||||
\end{subpf*}
|
||||
\pfln $|$ is transitive: Show that $\forall a, b, c \in A, a|b \land b|c \Rightarrow a |c)$ (theorem 4.3.3)
|
||||
\end{numpf*}
|
||||
|
||||
\end{proof}
|
||||
|
||||
|
||||
\begin{proof}[\proofname\ T01Q9] The product of any two odd integers is an odd integer
|
||||
\begin{numpf*}
|
||||
\pfln Take any 2 odd numbers $a$ and $b$
|
||||
\pfln Then $a = 2k+1$ and $b = 2p + 1$ for $k,p \in Z$ (by defn of odd number)
|
||||
\pfln Then $a\cdot b = (2k+1)(2p+1) = (4kp + 2k) + (2p + 1) = 2(2kp + p + k) +1$ (by defn of odd number)
|
||||
\pfln Let $q = 2kp + p +k$ which is an integer (by closure of int under $+$ and $\times$
|
||||
\pfln Then nm = 2q + 1 which is odd (by defn of odd numbers)
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
|
||||
\begin{proof}[\proofname\ T01Q10] Let $n$ be an integer. Then $n^2$ is odd iff $n$ is odd
|
||||
\begin{numpf*}
|
||||
\pfln Proof By Contraposition, that is "if n is even, $n^2$ is even $(\Rightarrow)$
|
||||
\begin{subpf*}
|
||||
\pfln Suppose $n$ is even.
|
||||
\pfln Then $\exists k \in \mathbb{Z}$ s.t. $n = 2k$ (by defn of even integers)
|
||||
\pfln $n^2 = (2k)^2 = 4k^2 = 2(2k^2)$
|
||||
\pfln Hence, $n^2$ = 2p, where $p = 2k^2 \in \mathbb{Z}$ (by closure of integers under $\times$)
|
||||
\pfln Therefore, $n^2$ is even and this proves that if $n^2$ is odd, $n$ is odd.
|
||||
\end{subpf*}
|
||||
\pfln If $n$ is odd, then $n \times n = n^2$ is odd (T01Q9)
|
||||
\pfln Therefore $n^2$ is odd if and only if $n$ is odd.
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
|
||||
\begin{proof}[\proofname\ T02Q3] Rational numbers are closed under addition
|
||||
\begin{numpf*}
|
||||
\pfln Let r and s be rational numbers
|
||||
\pfln $\exists a,b,c,d \in \mathbb{Z}$ s.t. $r =\frac{a}{b}, s = \frac{c}{d}$ and $b \not = 0, d \not = 0$ (by defn of rational numbers)
|
||||
\pfln Hence $r + s = \frac{a}{b} + \frac{c}{d} = \frac{ad + bc}{bd}$ (by basic algebra)
|
||||
\pfln $ad + bd \in Z$ and $bd \in Z$ (closure of integers under $+$ and $\times$)
|
||||
\pfln $bd \not = 0$ since $b \not = 0, d \not = 0$
|
||||
\pfln Hence $r+s$ is rational, therefore rational numbers are closed under addition
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
|
||||
\begin{proof}[\proofname\ T02Q10] if $n$ is a product of 2 positive integers $a$ and $b$, then $a \leq n^{1/2}$ or $b \leq n^{1/2}$
|
||||
\begin{numpf*}
|
||||
\pfln Proof by contraposition, that is if $a > n^{1/2}$ and $b > n^{1/2}$, then $n$ is not a product of $a$ and $b$
|
||||
\pfln Suppose $a > n^{1/2}$ and $b > n^{1/2}$, then $ab > n^{1/2} \cdot n^{1/2} = n$ (by Appendix A T27)
|
||||
\pfln Since $ab \not = n$, the contrapositive statement is true
|
||||
\end{numpf*}
|
||||
or by contradiction
|
||||
\begin{numpf*}
|
||||
\pfln Proof by contradiction, that is $n = ab$ and $a > n^{1/2}$ and $b > n^{1/2}$
|
||||
\pfln Since $a > n^{1/2}$ and $b > n^{1/2}$, then $ab > n^{1/2} \cdot n^{1/2} = n$ (by Appendix A T27)
|
||||
\pfln This contradicts $n = ab$. Therefore original statement is true
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
|
||||
\begin{proof}[\proofname\ T03Q04] Let $A = \{2n+1: n \in \mathbb{Z}\}$ and $B = \{2n-5: n \in \mathbb{Z}\}$. Is $A$ = $B$?
|
||||
\begin{numpf*}
|
||||
\pfln $\subseteq$
|
||||
\begin{subpf}
|
||||
\pfln Let $a \in A$, and $a = 2n + 1, n \in \mathbb{Z}$
|
||||
\pfln Then $a = 2n + 1 = 2 (n+3) - 5$
|
||||
\pfln $n + 3 \in Z$ (by closure of int under $+$)
|
||||
\pfln Therefore, $a \in B$ (by defn of B)
|
||||
\end{subpf}
|
||||
\pfln $\supseteq$
|
||||
\begin{subpf}
|
||||
\pfln Let $b \in A$, and $b = 2n - 5, n \in \mathbb{Z}$
|
||||
\pfln Then $b = 2n - 5 = 2 (n-3) + 1$
|
||||
\pfln $n - 3 \in Z$ (by closure of int under $-$)
|
||||
\pfln Therefore, $b \in A$ (by defn of B)
|
||||
\end{subpf}
|
||||
\pfln Therefore, A = B
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
\begin{proof}[\proofname\ T03Q05] Prove $\forall A, B, C, A \cap (B \setminus C) = (A \cap B) \setminus C$
|
||||
\begin{numpf*}
|
||||
\pfln $A \cap (B \setminus C) = \{x: x \in A \land x \in (B \setminus C) \}$ (by defn of $\cap$)
|
||||
\pfln $ = \{x: x \in A \land (x \in B \land x \not \in C) \}$ (by defn of $\setminus$)
|
||||
\pfln $ = \{x: x \in (A \land x \in B) \land x \not \in C \}$ (by associativity of $\land$)
|
||||
\pfln $ = \{x: x \in (A \cap B) \land x \not \in C \}$ (by defn of $\cap$)
|
||||
\pfln $ = \{x: x \in (A \cap B) \setminus C$ (by defn of $\setminus$)
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
\begin{proof}[\proofname\ T03Q05] Prove $\forall A, B, C, A \cap (B \setminus C) = (A \cap B) \setminus C$
|
||||
\begin{numpf*}
|
||||
\pfln $A \cap (B \setminus C) = \{x: x \in A \land x \in (B \setminus C) \}$ (by defn of $\cap$)
|
||||
\pfln $ = \{x: x \in A \land (x \in B \land x \not \in C) \}$ (by defn of $\setminus$)
|
||||
\pfln $ = \{x: x \in (A \land x \in B) \land x \not \in C \}$ (by associativity of $\land$)
|
||||
\pfln $ = \{x: x \in (A \cap B) \land x \not \in C \}$ (by defn of $\cap$)
|
||||
\pfln $ = \{x: x \in (A \cap B) \setminus C$ (by defn of $\setminus$)
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
|
||||
\begin{proof}[\proofname T03Q8] Let $A$ and $B$ be set. Show that $A \subseteq B$ if and only if $A \cup B = B$\\
|
||||
To show $A \cup B = B$, we need to show $A \cup B \subseteq B$ and $B \subseteq A \cup B$
|
||||
\begin{numpf*}
|
||||
\pfln $\implies$
|
||||
\begin{subpf}
|
||||
\pfln Suppose $A \subseteq B$
|
||||
\pfln (Show $A \cup B \subseteq B$)
|
||||
\begin{subpf}
|
||||
\pfln Let $z \in A \cup B$
|
||||
\pfln Then $z \in A$ or $z \in B$ (by defn of $\cup$)
|
||||
\pfln Case 1: Suppose $z \in A$, then $Z \in B$ as $A \subseteq B$ line (1.1)
|
||||
\pfln Case 2: Suppose $z \in B$, then $z \in B$. We have $z\in B$ in either case
|
||||
\end{subpf}
|
||||
\pfln (Show $A \cup B \supseteq B$)
|
||||
\begin{subpf}
|
||||
\pfln Let $z \in B$
|
||||
\pfln Then $z \in A$ or $z \in B$ (by generalization)
|
||||
\pfln So $z \in A \cup B$ (by defn of $\cup$)
|
||||
\end{subpf}
|
||||
\pfln Therefore $A \cup B = B$
|
||||
\end{subpf}
|
||||
\pfln $\impliedby$
|
||||
\begin{subpf}
|
||||
\pfln Suppose $A \cup B = B$
|
||||
\pfln Let $z \in A$
|
||||
\begin{subpf}
|
||||
\pfln Then $z \in A$ or $z \in B$ (by generalization)
|
||||
\pfln So $z \in A \cup B$ (by defn of $\cup$)
|
||||
\pfln So $z \in B$ since $A \cup B = B$ (2.1)
|
||||
\end{subpf}
|
||||
\pfln Therefore $A \subseteq B$
|
||||
\end{subpf}
|
||||
\pfln Therefore, $A \subseteq B$ if and only iff $A \cup B = B$
|
||||
\end{numpf*}
|
||||
\end{proof}
|
||||
|
||||
\begin{proof}[\proofname\ T04Q05] Relation $S = \{(m,n) \in \mathbb{Z}^2: m^3 + n^3 \text{is even} \}$, Proof $S \circ S = S$
|
||||
\begin{numpf*}
|
||||
\pfln ($\subseteq$) Suppose $(x, z) \in S \circ S$
|
||||
\begin{subpf}
|
||||
\pfln Then $(x, y) \in S$ and $(y, z) \in S$ for some $y \in Z$ (defn of composition of relations)
|
||||
\pfln So $x^3 + y^3$ is even and $y^3 + z^3$ is even
|
||||
\pfln This implies that $x^3 + 2y^3 + z^3$ is even
|
||||
\pfln This implies that $x^3 + z^3$ is even as $2y^3$ is even
|
||||
\pfln Therefore, $(x, z) \in S$ (by defn of $S$)
|
||||
\end{subpf}
|
||||
\pfln ($\supseteq$) Suppose $(x,z) \in S$
|
||||
\begin{subpf}
|
||||
\pfln Then $x^3 + z^3$ is even (by defn of S)
|
||||
\pfln Case 1: $x^3$ is odd.
|
||||
\begin{subpf}
|
||||
\pfln Then $z^3$ is also odd.
|
||||
\pfln This implies that $x^3 + 1^3$ is even and $1^3 + z^3$ is even
|
||||
\pfln Thus, $(x,1) \in S$ and $(1,z) \in S$ (by defn of S)
|
||||
\pfln So, $(x,z) \in S \circ S$
|
||||
\end{subpf}
|
||||
\pfln Case 2: $x^3$ is even.
|
||||
\begin{subpf}
|
||||
\pfln Then $z^3$ is also even.
|
||||
\pfln This implies that $x^3 + 0^3$ is even and $0^3 + z^3$ is even
|
||||
\pfln Thus, $(x,0) \in S$ and $(0,z) \in S$ (by defn of S)
|
||||
\pfln So, $(x,z) \in S \circ S$
|
||||
\end{subpf}
|
||||
\pfln In all cases, $(x,z) \in S \circ S$
|
||||
\end{subpf}
|
||||
OR
|
||||
\pfln ($\supseteq$) Suppose $(x,z) \in S$
|
||||
\begin{subpf}
|
||||
\pfln Note that $(x, x) \in S$ as $x^3 + x^3$ is even
|
||||
\pfln Since $(x, x) \in S$ and $(x,z) \in S$, we have $(x, z) \in S \circ S$ (by defn of composition of relations)
|
||||
\end{subpf}
|
||||
\end{numpf*}
|
||||
|
||||
\end{proof}
|
||||
|
||||
\begin{proof} $R$ is asymmetric if and only if $R$ is antisymmetric and irreflexive.
|
||||
\begin{numpf}
|
||||
\pfln $\implies$
|
||||
\begin{subpf}
|
||||
\pfln R is irreflexive (R is irreflexive $\implies$ R is antisymmetric and irreflexive)
|
||||
\begin{subpf}
|
||||
\pfln Let $x \in A$ s.t. $xRx \implies x \not R x$ (R is Asymmetric)
|
||||
\pfln Since $x\not R x$, R is irreflexive (by defn of irreflexive)
|
||||
\end{subpf}
|
||||
\end{subpf}
|
||||
\begin{subpf}
|
||||
\pfln R is antisymmetric (Tutorial Qn 6c)
|
||||
\end{subpf}
|
||||
\pfln $\impliedby$ (R is antisymmetric and irreflexive $\implies$ asymmetry)
|
||||
\begin{subpf}
|
||||
\pfln Let $x, y \in A$, s.t. xRy is antisymmetric and irreflexive
|
||||
\pfln There is 2 cases to consider, $x = y$ and $x \not = y$
|
||||
\pfln $x = y$
|
||||
\begin{subpf}
|
||||
\pfln $xRx$ is not valid as it contradicts irreflexive, $\forall x \in A(x\not R x)$
|
||||
\pfln Therefore, $xRx \implies x\not R x$
|
||||
\end{subpf}
|
||||
\pfln $x \not = y$
|
||||
\begin{subpf}
|
||||
\pfln $xRy \land yRx \implies x = y$
|
||||
\end{subpf}
|
||||
\end{subpf}
|
||||
\end{numpf}
|
||||
\end{proof}
|
||||
|
||||
|
||||
\pagebreak
|
||||
|
||||
\section{Tables}
|
||||
|
||||
\begin{tabular} {|l|c|c|}
|
||||
Commutative & $p \land q \equiv q \land p$ & $p \lor q \equiv q \lor p$\\
|
||||
Associative & $p \land q \land r \equiv (p \land q) \land r$&\\
|
||||
Distributive & $p \land (q \lor r) \equiv (p \land q) \lor (p \land r)$&$p \lor (q \land r) \equiv (p \lor q) \land (p \lor r)$\\
|
||||
Identity & $p \land \text{true} \equiv p$ & $p \lor \text{false} \equiv p$\\
|
||||
Negation & $p \lor \sim p \equiv \text{true}$ & $p \land \sim p \equiv \text{false}$\\
|
||||
Double Negative & $\sim(\sim p) \equiv p$ & \\
|
||||
Idempotent & $p \lor p \equiv p$ & $p \land p \equiv p$\\
|
||||
Universal bound & $p \lor \text{true} \equiv \text{true}$ & $p \land \text{false} \equiv \text{false}$\\
|
||||
de Morgan's & $\sim(p \land q) \equiv \sim p \lor \sim q$ & $\sim(p \lor q) \equiv \sim p \land \sim q$\\
|
||||
Absorption & $p \lor (p \land q) \equiv p$ & $p \land (p \lor q) \equiv p$\\
|
||||
Implication & $p \Rightarrow q \equiv \sim p \lor q$ & $$\\
|
||||
$\sim$(Implication) & $\sim (p \Rightarrow q) \equiv p \land \sim q$ & \\
|
||||
\hline & & \\
|
||||
Modus Ponens &$p \implies q, p$& $q$ \\
|
||||
Modus Tollens &$p \implies q, \sim q$& $\sim p$ \\
|
||||
Generalization &$p$& $p \lor q$ \\
|
||||
Specialization &$p \land q$& $p$ \\
|
||||
Conjunction &$p, q$& $p \land q$ \\
|
||||
Elimination &$p \lor q, \sim q$& $p$ \\
|
||||
Transitivity &$p \implies q, q \implies r$& $p \implies r$ \\
|
||||
Division into cases &$p \land q, p \implies r, q \implies r$& $r$ \\
|
||||
Contradiction &$\sim p \implies \text{false}$& $p$ \\
|
||||
\hline & & \\
|
||||
Commutative & $A \cup B = B \cup A$ & \\
|
||||
Associative & $(A \cup B) \cup C = A \cup (B \cup C)$ & \\
|
||||
Distributive & $A \cup (B \cap C) = (A \cup B) \cap (A \cup C)$ & $A \cap (B \cup C) = (A \cap B) \cup (A \cap C)$\\
|
||||
Identity & $A \cup \emptyset = A$ & $A \cap U = A$\\
|
||||
Complement & $A \cup \bar A = U$ & $A \cap \bar A = \emptyset$\\
|
||||
Double Complement & $\bar{\bar A} = A$ & \\
|
||||
Idempotent & $A \cup A = A$ & $A \cap A = A$\\
|
||||
Universal Bound & $A \cup U = U$ & $A \cap \emptyset = \emptyset$ \\
|
||||
De Morgan's & $\overline{A \cup B} = \bar{A} \cap \bar{B}$ & $\overline{A \cap B} = \bar{A} \cup \bar{B}$\\
|
||||
Absorption & $A \cup (A \cap B) = A$ & $A \cap (A \cup B) = A$\\
|
||||
Complements of U and $\emptyset$ & $\bar U =\emptyset$ & $\bar \emptyset = U$\\
|
||||
Set Difference & $A \setminus B = A \cap \bar B$ &\\
|
||||
\hline & & \\
|
||||
F1 Commutative & $a + b = b + a$ & $ab = ba$ \\
|
||||
F2 Associative & $(a + b)+c = a + (b + c)$ & $(ab)c = a(bc)$ \\
|
||||
F3 Distributive & $a(b+c) = ab + ac$ & $(b+c)a = ba + ca$ \\
|
||||
F4 Identity & $0 +a = a + 0 = a$ & $1 \cdot a = a \cdot 1 = a $ \\
|
||||
F5 Additive inverses & $a + (-a) = (-a) + a = 0$ & \\
|
||||
F6 Reciprocals & $a \cdot \frac{1}{a} = \frac{1}{a} \cdot a = 1$ & $a \not = 0$ \\
|
||||
\hline & & \\
|
||||
T1 Cancellation Add & $a + b = a + c$ & $b = c$ \\
|
||||
T2 Possibility of Sub & There is one $x, a + x = b$ & $x = b - a$ \\
|
||||
T3 & $b - a = b + (-a)$ & \\
|
||||
T4 & $-(-a) = a$ & \\
|
||||
T5 & $a(b-c)=ab-ac$ & \\
|
||||
T6 & $0 \cdot a = a \cdot 0 = 0$ & \\
|
||||
T7 Cancellation Mul & $ab = ac$ & $b = c, a \not = 0$ \\
|
||||
T8 Possibility of Div & $a \not = 0, ax = b$ & $x = \frac{b}{a}$ \\
|
||||
T9 & $a \not = 0, \frac{b}{a} = b \cdot a^{-1}$ & \\
|
||||
T10 & $a \not = 0, (a^{-1})^{-1} = a$ & \\
|
||||
T11 Zero Product& $ab = 0 \Rightarrow a = 0 \lor b = 0$ & \\
|
||||
T12 Mul with -ve & $(-a)b = a(-b) - -(ab)$ & $-\frac{a}{b} = \frac{-a}{b} = \frac{a}{-b}$\\
|
||||
T13 Equiv Frac & $\frac{a}{b} = \frac{ac}{bc}$ & $b \not = 0, c \not = 0$\\
|
||||
T14 Add Frac & $\frac{a}{b} + \frac{c}{d} = \frac{ad + bc}{bd}$ & $b \not = 0, d \not = 0$\\
|
||||
T15 Mul Frac & $\frac{a}{b} \cdot \frac{c}{d} = \frac{ac}{bd}$ & $b \not = 0, d \not = 0$\\
|
||||
T16 Div Frac & $\frac{\frac{a}{b}}{\frac{c}{d}} = \frac{ac}{bd}$ & $b \not = 0, d \not = 0$\\
|
||||
\end{tabular}
|
||||
|
||||
\begin{tabular} {|l|c|c|}
|
||||
\hline & & \\
|
||||
Ord1 & $\forall a,b \in \mathbb{R}^+$ & $a + b > 0, ab > 0$\\
|
||||
Ord2 & $\forall a,b \in \mathbb{R}_{\not = 0}$ & $a$ is positive or negative and not both\\
|
||||
Ord3 & 0 is not positive & \\
|
||||
$a < b$ & means $b + (-a)$ is positive & \\
|
||||
$a \leq b$ & means $a < b$ or $a = b$ & \\
|
||||
$a < 0$ & means a is negative& \\
|
||||
T17 Trichotomy Law & $a < b \lor b > a \lor a = b$ & \\
|
||||
T18 Transitive Law & $a < b$ and $b < c$ & $a < c$\\
|
||||
T19 & $a < b$ & $a + c < b + c$ \\
|
||||
T20 & $a < b$ and $c > 0$ & $ac < bc$ \\
|
||||
T21 & $a \not = 0$ & $a^2 > 0$ \\
|
||||
T22 & $1 > 0$ & \\
|
||||
T23 & $a < b$ and $c < 0$ & $ac > bc$ \\
|
||||
T24 & $a < b$ & $-a > -b$ \\
|
||||
T25 & $ab > 0$ & a and b are both positive or negative \\
|
||||
T26 & $a < c$ and $b < d$ & $a+b < c+d$ \\
|
||||
T30 & $0 < a < c$ and $<0 < b < d$ & $0 < ab < cd$ \\
|
||||
\end{tabular}
|
||||
|
||||
\end{document}
|
BIN
cheatsheets/ma1301/cheetsheet.pdf
Normal file
BIN
cheatsheets/ma1301/cheetsheet.pdf
Normal file
Binary file not shown.
280
cheatsheets/ma1301/cheetsheet.tex
Normal file
280
cheatsheets/ma1301/cheetsheet.tex
Normal file
@ -0,0 +1,280 @@
|
||||
\documentclass[a4paper,twoside,notitlepage,10pt]{article}
|
||||
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{lipsum}
|
||||
\usepackage{multicol}
|
||||
|
||||
\usepackage[margin=0.5in]{geometry}
|
||||
|
||||
\usepackage{lscape}
|
||||
\usepackage{pdflscape}
|
||||
\usepackage{mathtools}
|
||||
\usepackage{parskip}
|
||||
\usepackage{blindtext}
|
||||
\usepackage{fontspec}
|
||||
\usepackage{pgfplots}
|
||||
\usepackage{array}
|
||||
\usepackage{amsmath}
|
||||
\newcolumntype{L}{>{$}l<{$}} % mathmode version of l
|
||||
\pgfplotsset{compat = newest}
|
||||
|
||||
\setmainfont{texgyrepagella}[
|
||||
Extension = .otf,
|
||||
UprightFont = *-regular,
|
||||
BoldFont = *-bold,
|
||||
ItalicFont = *-italic,
|
||||
BoldItalicFont = *-bolditalic,
|
||||
]
|
||||
|
||||
\begin{document}
|
||||
|
||||
\title{MA1301 Midterm Reference}
|
||||
\author{Yadunand Prem}
|
||||
\setlength{\parindent}{0pt}
|
||||
|
||||
\begin{landscape}
|
||||
\begin{multicols}{3}
|
||||
|
||||
\section{AP \& GP}
|
||||
|
||||
\subsection{Series}
|
||||
|
||||
Let $u_1, u_2,... u_n$ be a sequence
|
||||
|
||||
then $S_n = u_1 + u_2 + u_3 + ... + u_n$
|
||||
|
||||
Result $u_1 = S_1$, $u_n = S_n - S_{n-1}$
|
||||
|
||||
In summation form: $S_n = \sum_{i=1}^{n} u_i$
|
||||
|
||||
\subsection{Arithmetic Series}
|
||||
|
||||
Arithmetic Progression: $a, a+d, a+2d,...$
|
||||
|
||||
Common Difference: $d = u_{n} - u_{n-1}$
|
||||
|
||||
Nth Term: $u_n=a+(n-1)d$
|
||||
|
||||
Sum of Sequence: $\frac{n}{2}(u_1 + u_n) = \frac{n}{2}[2a+(n-1)d]$
|
||||
|
||||
\subsection{Geometric Series}
|
||||
|
||||
Geometric Progression: $a, ar, ar^2, ar^3,...$
|
||||
|
||||
Common Ratio: $r = \frac{u_2}{u_1} = \frac{u_3}{u_2} = ... = \frac{u_n}{u_n-1}$
|
||||
|
||||
Nth Term: $u_n = ar^{n-1}$
|
||||
|
||||
Sum: $S_n = \frac{a}{1-r}(1-r^n),\, r \neq 1$ when $r = 1, S_n = na$
|
||||
|
||||
Sum to infinite: $\text{for}-1 < r < 1, \, S_{\infty} = \frac{a}{1-r}$
|
||||
|
||||
\subsection{Binomial Theorem}
|
||||
|
||||
Coeff: $\binom{n}{r} = \frac{n!}{r!(n-r)!}$
|
||||
|
||||
Theorem: $(a+b)^n = \binom{n}{0}a^{n}b^{0} + \binom{n}{1}a^{n-1}b^{1} + ...+ \binom{n}{n}a^{0}b^{n}$
|
||||
|
||||
Generalized Coeff: $\binom{n}{r} = \frac{n(n-1)(n-2)...(n-r+1)}{r!}$
|
||||
|
||||
E.g. $\binom{\frac{1}{2}}{3} = \frac{(\frac{1}{2})(-\frac{1}{2})(-\frac{3}{2}))}{3!}$
|
||||
|
||||
Generalized Theorem: $(1+a)^n = 1+na+\frac{n(n-1)}{2!}a^2 + ...\,\\
|
||||
\text{when}\, n < 0 \text\,{and} -1 < a < 1$
|
||||
|
||||
Telescoping Series: $\sum^n_{r=m}(a_r - a_{r\pm1})$
|
||||
|
||||
|
||||
\section{Differentiation}
|
||||
\renewcommand{\arraystretch}{1.2}
|
||||
|
||||
\begin{tabular}{l| l}
|
||||
Function & Differential\\
|
||||
$(f(x))^n$ & $nf'(x)(f(x))^{n-1}$\\
|
||||
$\cos(x)$ & $-\sin(x)$\\
|
||||
$\sin(x)$ & $\cos(x)$\\
|
||||
$\tan(x)$ & $\sec^2(x)$\\
|
||||
$\sec(x)$ & $\sec(x)\tan(x)$\\
|
||||
$\csc(x)$ & $-\csc(x)\cot(x)$\\
|
||||
$\cot(x)$ & $-\csc^2(x)$\\
|
||||
$e^{f(x)}$ & $f'(x)e^{f(x)}$\\
|
||||
$\ln(f(x))$ & $\frac{f'(x)}{f(x)}$\\
|
||||
$\sin^{-1}(f(x))$ & $\frac{f'(x)}{\sqrt{1-f(x)^2}}$\\
|
||||
$\cos^{-1}(f(x))$ & $-\frac{f'(x)}{\sqrt{1-f(x)^2}}$\\
|
||||
$\tan^{-1}(f(x))$ & $\frac{f'(x)}{1+f(x)^2}$\\
|
||||
\end{tabular}
|
||||
|
||||
Product Rule: $\frac{d}{dx}(ab) = \frac{da}{dx}(b) + \frac{db}{dx}(a)$\\
|
||||
Quotient Rule: $\frac{d}{dx}(\frac{a}{b}) = \frac{\frac{da}{dx}(b) - \frac{db}{dx}(a)}{b^2}$\\
|
||||
Chain Rule: $\frac{dy}{dx} = \frac{dy}{du} \times \frac{du}{dx}$
|
||||
|
||||
Implicit: $\frac{d}{dx}(y^n) = ny^{n-1}\frac{dy}{dx}$\\
|
||||
$y=f(x)^{g(x)}\\
|
||||
\ln(y) = g(x)\ln(f(x))$
|
||||
|
||||
$\frac{d}{dx}(a^x) = a^{x}ln(a) \times \frac{d}{dx}(x)$
|
||||
|
||||
$\frac{d^2y}{dx^2} = \frac{d}{du}(\frac{dy}{dx}) \times \frac{du}{dx}$
|
||||
|
||||
Equation of tangent: $y-y_0 = m(x-x_0)$\\
|
||||
Equation of normal: $y-y_0 = -\frac{1}{m}(x-x_0)$
|
||||
|
||||
|
||||
\begin{tikzpicture}
|
||||
\draw[->] (-2, 0) -- (2, 0) node[right] {$x$};
|
||||
\draw[->] (0, 0) -- (0, 3) node[above] {$y$};
|
||||
\draw[scale=0.5, domain=-2:2,smooth,variable=\x] plot({\x}, {\x*\x+1}) node[right] {$y=x^2+1$};
|
||||
\draw[scale=0.5, domain=-2.5:2.5,smooth,variable=\x] plot({\x}, {1}) node[right] {$y=1$};
|
||||
\end{tikzpicture}
|
||||
|
||||
Tangent $//$ $x$-axis, $\frac{dy}{dx} = 0$
|
||||
|
||||
\begin{tikzpicture}
|
||||
\draw[->] (0, 0) -- (2, 0) node[right] {$x$};
|
||||
\draw[->] (0, -2) -- (0, 2) node[above] {$y$};
|
||||
\draw[scale=0.5, domain=-2:2,smooth,variable=\y] plot({\y*\y+1}, {\y}) node[right] {$x=y^2+1$};
|
||||
\draw[scale=0.5, domain=-2.5:2.5,smooth,variable=\y] plot({1}, {\y}) node[right] {$x=1$};
|
||||
\end{tikzpicture}
|
||||
|
||||
Tangent $//$ $y$-axis, $\frac{dy}{dx} = \pm\infty$
|
||||
|
||||
If $f \approx a, f(x) \approx f'(a)[x-a] + f(a)$\\
|
||||
If $f'(x) > 0$ it is increasing, else decreasing\\
|
||||
If $f''(x) > 0$ it is concave up, else concave down\\\\
|
||||
If $f'(x) = 0 \ \& f''(x) < 0$ it is local maximum\\
|
||||
If $f'(x) = 0 \ \& f''(x) > 0$ it is local minimum\\
|
||||
If $f'(x) = 0 \ \& f''(x) = 0$ test fails\\
|
||||
|
||||
|
||||
\subsection{Trigonometric Identities}
|
||||
|
||||
\begin{tabular}{|L|}
|
||||
\sin^2{\theta} + \cos^2{\theta} = 1 \\
|
||||
\tan^2{\theta} + 1 = \sec^2{\theta} \\
|
||||
1 + \cot^2{\theta} = \csc^2{\theta} \\
|
||||
\hline
|
||||
\sin{2\theta} = 2\sin{\theta}\cos{\theta} \\
|
||||
\cos{2\theta} = \cos^2{\theta}-\sin^2{\theta} \\
|
||||
\cos{2\theta} = 2\cos^2{\theta}-1 \\
|
||||
\cos{2\theta} = 1-2\sin^2{\theta} \\
|
||||
\tan{2\theta} = \frac{2\tan{\theta}}{1-\tan^2{\theta}} \\
|
||||
\hline
|
||||
\sin({\alpha + \beta}) = \sin{\alpha}\cos{\beta} \pm \cos{\alpha}\sin{\beta} \\
|
||||
\cos({\alpha + \beta}) = \cos{\alpha}\cos{\beta} \mp \sin{\alpha}\sin{\beta}
|
||||
\end{tabular}
|
||||
|
||||
|
||||
\end{multicols}
|
||||
\begin{multicols}{2}
|
||||
|
||||
\section{Integration}
|
||||
|
||||
\subsection{Standard Integrals}
|
||||
\begin{tabular}{|L|L|L}
|
||||
1 & \int(ax+b)^n\ dx & \frac{(ax+b)^{n+1}}{(n+1)a} + C \\
|
||||
2 & \int \frac{1}{ax+b}\ dx & \frac{1}{a}\ln|ax+b| + C \\
|
||||
3 & \int e^{ax+b}\ dx & \frac{1}{a}e^{ax+b} + C \\
|
||||
4 & \int \sin(ax+b)\ dx & -\frac{1}{a}\cos(ax+b) + C \\
|
||||
5 & \int \cos(ax+b)\ dx & \frac{1}{a}\sin(ax+b) + C \\
|
||||
6 & \int \tan(ax+b)\ dx & \frac{1}{a}\ln|\sec(ax+b)| + C \\
|
||||
7 & \int \sec(ax+b)\ dx & \frac{1}{a}\ln|\sec(ax+b) + \tan(ax+b)| + C \\
|
||||
8 & \int \csc(ax+b)\ dx & -\frac{1}{a}\ln|\csc(ax+b) + \cot(ax+b)| + C \\
|
||||
9 & \int \cot(ax+b)\ dx & -\frac{1}{a}\ln|\csc(ax+b)| + C \\
|
||||
10 & \int \sec^2(ax+b)\ dx & \frac{1}{a}\tan(ax+b) + C \\
|
||||
11 & \int \csc^2(ax+b)\ dx & -\frac{1}{a}\cot(ax+b) + C \\
|
||||
12 & \int \sec(ax+b) \cdot \tan(ax+b)\ dx & \frac{1}{a}\sec(ax+b) + C \\
|
||||
13 & \int \csc(ax+b) \cdot \cot(ax+b)\ dx & -\frac{1}{a}\csc(ax+b) + C \\
|
||||
14 & \int \frac{1}{a^2+(x+b)^2}\ dx & \frac{1}{a}\tan^{-1}(\frac{x+b}{a})+ C \\
|
||||
15 & \int \frac{1}{\sqrt{a^2-(x+b)^2}}\ dx & \sin^{-1}(\frac{x+b}{a})+ C \\
|
||||
16 & \int \frac{-1}{\sqrt{a^2-(x+b)^2}}\ dx & \cos^{-1}(\frac{x+b}{a})+ C \\
|
||||
17 & \int \frac{1}{a^2-(x+b)^2}\ dx & \frac{1}{2a}\ln|\frac{x+b+a}{x+b-a}|+ C \\
|
||||
18 & \int \frac{1}{(x+b)^2-a^2}\ dx & \frac{1}{2a}\ln|\frac{x+b-a}{x+b+a}|+ C \\
|
||||
19 & \int \frac{1}{\sqrt{(x+b)^2+a^2}}\ dx & \ln|(x+b) + \sqrt{(x+b)^2+a^2}| + C \\
|
||||
20 & \int \frac{1}{\sqrt{(x+b)^2-a^2}}\ dx & \ln|(x+b) + \sqrt{(x+b)^2-a^2}| + C \\
|
||||
21 & \int \frac{1}{\sqrt{(x+b)^2-a^2}}\ dx & \ln|(x+b) + \sqrt{(x+b)^2-a^2}| + C \\
|
||||
21 & \int a^x\ dx & \frac{a^x}{\ln a} + C \\
|
||||
|
||||
\end{tabular}
|
||||
|
||||
\subsection{Integration by Parts}
|
||||
$\int u\ dv = uv - \int v\ du$
|
||||
|
||||
Rule for choosing $u$
|
||||
|
||||
\begin{tabular}{|l|L|}
|
||||
Logarithm & \ln(ax+b) \\
|
||||
Inverse Trigo & \sin^{-1}(ax+b) \\
|
||||
Algebraic & x, x^{10} \\
|
||||
Trigo & \sin (ax+b) \\
|
||||
Expo & e^x, 19^x \\
|
||||
\end{tabular}
|
||||
|
||||
\subsection{Area between 2 curves}
|
||||
|
||||
$A = \int^b_a g(x) - f(x)dx,\ \text{when}\ g(x)\ \text{is above}\ f(x)$
|
||||
|
||||
\subsection{Volume of Revolution}
|
||||
|
||||
$V = \pi\int^b_a(f(x)-a)^2\ dx$ when $a$ is a line parallel to $x$ or axis
|
||||
|
||||
$V = \pi\int^b_a(f(x))^2\ dx - \pi\int^b_a(g(x))^2\ dx$ when $f(x)$ is higher than $g(x)$
|
||||
|
||||
\section{Vectors}
|
||||
|
||||
$\overrightarrow{OA} = a = \big(\begin{smallmatrix}
|
||||
x_1 \\
|
||||
y_1 \\
|
||||
z_1 \\
|
||||
\end{smallmatrix}\big)= x_1\text{i} + y_1\text{j}+ z_1\text{k}$
|
||||
|
||||
$\overrightarrow{OB} = b = \big(\begin{smallmatrix}
|
||||
x_2 \\
|
||||
y_2 \\
|
||||
z_2 \\
|
||||
\end{smallmatrix}\big) = x_2\text{i} + y_2\text{j}+ z_2\text{k}$
|
||||
|
||||
Magnitude = $|\overrightarrow{AB}| = \sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}$
|
||||
|
||||
$\overrightarrow{AB} =\overrightarrow{OB} - \overrightarrow{OA}$ = $\big(\begin{smallmatrix}
|
||||
x_2 - x_1 \\
|
||||
y_2 - y_1 \\
|
||||
\end{smallmatrix}\big)$
|
||||
|
||||
Unit Vector : $\hat{v} = \frac{1}{|v|}v$
|
||||
|
||||
Dot Product: $a \cdot b = x_1x_2+y_1y_2+z_1z_2 = |a||b|\cos\theta $
|
||||
|
||||
If $a\perp b$, $a \cdot b = 0$
|
||||
|
||||
$\theta = \cos^{-1}\big(\frac{a \cdot b}{|a||b|}\big)$
|
||||
|
||||
Cross Product: $a \times b = \begin{pmatrix}
|
||||
y_1z_2 - y_2z_1 \\
|
||||
-(x_1z_2 - x_2z_2)\\
|
||||
x_1y_2 - x_2y_1)
|
||||
\end{pmatrix}$
|
||||
|
||||
Area of $\triangle ABC = \frac{1}{2}|\overrightarrow{CA} \times \overrightarrow{CB}|$
|
||||
|
||||
$|a \times b| = |a||b|\sin\theta$
|
||||
|
||||
Line: $r = a + \lambda u \Leftrightarrow r = (x_1\text{i} + y_1\text{j} + z_1\text{k}) + t(a\text{i} + b\text{j} + c\text{k})$ where $a$ is a point and $u$ is a direction vector
|
||||
|
||||
If Point $P\perp$ to line $r = a + s \overrightarrow{u}$, $Q = (a + \lambda \overrightarrow{u})$, $\overrightarrow{PQ} \cdot \overrightarrow{u} = 0$
|
||||
|
||||
Shortest distance = $|PQ|$
|
||||
|
||||
Plane: $(\overrightarrow{r} - \overrightarrow{a}) \cdot n = 0 \Leftrightarrow \overrightarrow{r} \cdot \overrightarrow{n} = \overrightarrow{a} \cdot \overrightarrow{n}$, where $a$ and $r$ are 2 vectors on the plane and $n$ is normal to the plane
|
||||
|
||||
Cartesian Eqn of plane: $r \cdot n = d \Leftrightarrow ax + by + cz = d$, where $n = ai + bj + ck$ and $r = xi + yj + zk$
|
||||
|
||||
Angle between planes: $\cos\theta =|\frac{n_1 \cdot n_2}{|n_1||n_2|}|$
|
||||
Angle between line and plane: $\sin\theta = |\frac{u \cdot n}{|u||n|}|$
|
||||
|
||||
Intersection of 2 planes: $r = a + \lambda(n_1 \times n_2)$
|
||||
|
||||
\end{multicols}
|
||||
|
||||
\end{landscape}
|
||||
|
||||
\end{document}
|
BIN
cheatsheets/ma1521/finals.pdf
Normal file
BIN
cheatsheets/ma1521/finals.pdf
Normal file
Binary file not shown.
362
cheatsheets/ma1521/finals.tex
Normal file
362
cheatsheets/ma1521/finals.tex
Normal file
@ -0,0 +1,362 @@
|
||||
\documentclass[10pt,landscape]{article}
|
||||
\usepackage[scaled=0.8]{helvet}
|
||||
|
||||
\usepackage{calc}
|
||||
\usepackage{multicol}
|
||||
\usepackage{ifthen}
|
||||
\usepackage[a4paper,margin=3mm,landscape]{geometry}
|
||||
\usepackage{amsmath,amsthm,amsfonts,amssymb}
|
||||
\usepackage{hyperref}
|
||||
\usepackage{newtxtext}
|
||||
\usepackage{enumitem}
|
||||
\usepackage{amssymb}
|
||||
\usepackage[table]{xcolor}
|
||||
\usepackage{vwcol}
|
||||
\usepackage{tikz}
|
||||
\usepackage{wrapfig}
|
||||
\usepackage{makecell}
|
||||
% Testing %
|
||||
\usepackage{blindtext}
|
||||
\usetikzlibrary{calc}
|
||||
|
||||
\setlist{nosep}
|
||||
\graphicspath{ {./images/} }
|
||||
|
||||
\pagestyle{empty}
|
||||
\newenvironment{tightcenter}{%
|
||||
\setlength\topsep{0pt}
|
||||
\setlength\parskip{0pt}
|
||||
\begin{center}
|
||||
}{%
|
||||
\end{center}
|
||||
}
|
||||
|
||||
% redefine section commands to use less space
|
||||
\makeatletter
|
||||
\renewcommand{\section}{\@startsection{section}{1}{0mm}%
|
||||
{-1ex plus -.5ex minus -.2ex}%
|
||||
{0.5ex plus .2ex}%x
|
||||
{\normalfont\large\bfseries}}
|
||||
\renewcommand{\subsection}{\@startsection{subsection}{2}{0mm}%
|
||||
{-1explus -.5ex minus -.2ex}%
|
||||
{0.5ex plus .2ex}%
|
||||
{\normalfont\normalsize\bfseries}}
|
||||
\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{0mm}%
|
||||
{-1ex plus -.5ex minus -.2ex}%
|
||||
{1ex plus .2ex}%
|
||||
{\normalfont\small\bfseries}}%
|
||||
\renewcommand{\familydefault}{\sfdefault}
|
||||
\renewcommand\rmdefault{\sfdefault}
|
||||
% makes nested numbering (e.g. 1.1.1, 1.1.2, etc)
|
||||
\renewcommand{\labelenumii}{\theenumii}
|
||||
\renewcommand{\theenumii}{\theenumi.\arabic{enumii}.}
|
||||
\renewcommand\labelitemii{•}
|
||||
% for logical not operator
|
||||
\renewcommand{\lnot}{\mathord{\sim}}
|
||||
\renewcommand{\bf}[1]{\textbf{#1}}
|
||||
\newcommand{\abs}[1]{\vert #1 \vert}
|
||||
\newcommand{\Mod}[1]{\ \mathrm{mod}\ #1}
|
||||
\newcommand{\vv}[1]{\boldsymbol{#1}}
|
||||
\newcommand{\VV}[1]{\overrightarrow{#1}}
|
||||
\newcommand{\cvv}[1]{\left(\begin{smallmatrix}#1\end{smallmatrix}\right)}
|
||||
|
||||
\makeatother
|
||||
\definecolor{myblue}{cmyk}{1,.72,0,.38}
|
||||
% Define BibTeX command
|
||||
\everymath\expandafter{\the\everymath \color{myblue}}
|
||||
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
|
||||
T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
|
||||
\let\iff\leftrightarrow
|
||||
\let\Iff\Leftrightarrow
|
||||
\let\then\rightarrow
|
||||
\let\Then\Rightarrow
|
||||
|
||||
% Don't print section numbers
|
||||
\setcounter{secnumdepth}{0}
|
||||
|
||||
\setlength{\parindent}{0pt}
|
||||
\setlength{\parskip}{0pt plus 0.5ex}
|
||||
%% this changes all items (enumerate and itemize)
|
||||
\setlength{\leftmargini}{0.5cm}
|
||||
\setlength{\leftmarginii}{0.5cm}
|
||||
\setlist[itemize,1]{leftmargin=2mm,labelindent=1mm,labelsep=1mm}
|
||||
\setlist[itemize,2]{leftmargin=4mm,labelindent=1mm,labelsep=1mm}
|
||||
|
||||
%My Environments
|
||||
\newtheorem{example}[section]{Example}
|
||||
% -----------------------------------------------------------------------
|
||||
|
||||
\begin{document}
|
||||
\raggedright
|
||||
\footnotesize
|
||||
\begin{multicols*}{4}
|
||||
\setlength{\columnseprule}{0.25pt}
|
||||
\setlength{\premulticols}{1pt}
|
||||
\setlength{\postmulticols}{1pt}
|
||||
\setlength{\multicolsep}{1pt}
|
||||
\setlength{\columnsep}{2pt}
|
||||
|
||||
\section{Function and Limits}
|
||||
\begin{itemize}
|
||||
\item $\lim\limits_{x\to \pm \infty}\frac{Ax^\alpha}{Bx^\beta}
|
||||
\begin{cases}
|
||||
0 & \text{if} \alpha < \beta\\
|
||||
\frac{A}{B} & \text{if} \alpha = \beta\\
|
||||
\pm \infty & \text{if} \alpha > \beta\\
|
||||
\end{cases}$
|
||||
\item $\lim\limits_{x\to c}\frac{sin(g(x))}{g(x)} = 1(\lim\limits_{x \to c}g(x) = 0)$
|
||||
\item $\lim\limits_{x\to c}\frac{tan(g(x))}{g(x)} = 1$
|
||||
\item $\lim\limits_{x\to 0}\frac{sin(x)}{x} = 1$
|
||||
\item $\lim\limits_{x\to 0}\frac{tan(x)}{x} = 1$
|
||||
\end{itemize}
|
||||
|
||||
|
||||
\section{Differentiation}
|
||||
parametric differentiaton: $\frac{d^2y}{dx^2} = \frac{d}{dx}(\frac{dy}{dx}) = \frac{\frac{d}{dt}(\frac{dy}{dx})}{\frac{dx}{dt}}$
|
||||
|
||||
\begin{tabular}{|>{\color{black}}c | >{\color{black}}c|}
|
||||
\hline
|
||||
$f(x)$ & $f'(x)$
|
||||
\\ \hline
|
||||
\rule{0pt}{2.3ex} % top spacing
|
||||
$\tan x$ & $\sec ^2 x$ \\
|
||||
$\csc x$ & $-\csc x \cot x$ \\
|
||||
$\sec x$ & $\sec x \tan x$ \\
|
||||
$\cot x$ & $- \csc ^2 x$
|
||||
\\ \hline
|
||||
\rule{0pt}{2.3ex} % top spacing
|
||||
$a^{f(x)}$ & $\ln a \cdot f'(x)a^{f(x)}$ \\
|
||||
$\log_af(x)$ & $\log_a e \cdot \frac{f'(x)}{f(x)}$
|
||||
\\[1ex] \hline
|
||||
\rule{0pt}{3ex} % top spacing
|
||||
$\sin^{-1} f(x)$ & $\frac{f'(x)}{\sqrt{1-[f(x)]^2}}, \ \ _{\vert f(x) \vert < 1}$ \\[1.5ex]
|
||||
$\cos^{-1} f(x)$ & $-\frac{f'(x)}{\sqrt{1-[f(x)]^2}}, \ \ _{\vert f(x) \vert < 1}$ \\[1.5ex]
|
||||
$\tan^{-1} f(x)$ & $\frac{f'(x)}{1 + [f(x)]^2}$ \\[1.5ex]
|
||||
$\cot^{-1} f(x)$ & $-\frac{f'(x)}{1 + [f(x)]^2}$ \\[1.5ex]
|
||||
$\sec^{-1} f(x)$ & $\frac{f'(x)}{\vert f(x) \vert \sqrt{[f(x)]^2-1}}$ \\[1.5ex]
|
||||
$\csc^{-1} f(x)$ & $-\frac{f'(x)}{\vert f(x) \vert \sqrt{[f(x)]^2-1}}$ \\[2ex]
|
||||
\hline
|
||||
\end{tabular}
|
||||
|
||||
\textbf{Second Derivative} Test: $f'(c) = 0, f''(c) < 0$ then local max, $f''(c) > 0$ local min.
|
||||
|
||||
\textbf{L'Hopital's Rule}: Given $\lim\limits_{x\to c}f(x) $ and $ g(x) = 0 / \pm \infty$ $ \lim\limits_{x \to c}\frac{f(x)}{g(x)} = \lim\limits_{x \to c}\frac{f'(x)}{g'(x)}$
|
||||
\begin{itemize}
|
||||
\item Use for $\frac{0}{0}$ or $\frac{\infty}{\infty}$
|
||||
\end{itemize}
|
||||
|
||||
\subsection*{Trigo Identities}
|
||||
\begin{enumerate}
|
||||
\item $\sec^2x - 1 = \tan^2x$
|
||||
\item $\csc^2x - 1 = \cot^2x$
|
||||
\item $\sin A\cos A = \frac{1}{2}\sin2A$
|
||||
\item $\cos^2A = \frac{1}{2}(1+\cos2A)$
|
||||
\item $\sin^2A = \frac{1}{2}(1-\cos2A)$
|
||||
\item $\sin A\cos B = \frac{1}{2}(\sin(A + B) + \sin(A - B)$
|
||||
\item $\cos A\sin B = \frac{1}{2}(\sin(A + B) - \sin(A - B)$
|
||||
\item $\cos A\cos B = \frac{1}{2}(\cos(A + B) + \cos(A - B)$
|
||||
\item $\sin A\sin B = \frac{1}{2}(\cos(A + B) - \cos(A - B)$
|
||||
\end{enumerate}
|
||||
|
||||
\section{Integration}
|
||||
|
||||
\begin{tabular}{|>{\color{black}}c | >{\color{black}}c|}
|
||||
\hline
|
||||
$f(x)$ & $\int f(x)$\\
|
||||
$\tan ax$ & $\frac{1}{a}\ln|\sec(ax)|$\\
|
||||
$\cot ax$ & $\frac{1}{a}\ln|\cot(ax)|$\\
|
||||
$\sec ax$ & $\frac{1}{a}\ln|\sec(ax) + tan(ax)|$\\
|
||||
$\csc ax$ & $\frac{1}{a}\ln|\csc(ax) + cot(ax)|$\\
|
||||
\hline
|
||||
$\frac{1}{a^2+(x+b)^2}$ & $\frac{1}{a}\tan^{-1}(\frac{x+b}{a})$\\
|
||||
$\frac{1}{\sqrt{a^2-(x+b)^2}}$ & $\sin^{-1}(\frac{x+b}{a})$\\
|
||||
$\frac{1}{a^2-(x+b)^2}$ & $\frac{1}{2a}\ln|\frac{x+b+a}{x+b-a}|$\\
|
||||
$\frac{1}{(x+b)^2-a^2}$ & $\frac{1}{2a}\ln|\frac{x+b-a}{x+b+a}|$\\
|
||||
\hline
|
||||
\end{tabular}
|
||||
|
||||
\textbf{Substitution} $\int f(g(x)) \cdot g'(x) dx = \int f(u) du, u = g(x)$
|
||||
|
||||
\textbf{By Parts} $\int u v' dx = uv - \int u'v dx$, order: LIATE: Differentiate to integrate
|
||||
|
||||
\subsection{Application of Integration}
|
||||
about x axis
|
||||
\begin{itemize}
|
||||
\item Vol Disk: $V = \pi \int^b_a f(x)^2 - g(x)^2 dx$
|
||||
\item Vol Shell: $V = 2\pi\int^b_a x|f(x)-g(x)|dx$ (absolute!!)
|
||||
\item Length of curve: $\int^b_a \sqrt{1+f'(x)^2}dx$
|
||||
\end{itemize}
|
||||
\section{Series}
|
||||
TODO!!
|
||||
|
||||
\section{Vectors}
|
||||
unit vector: $\hat{p} = \frac{p}{|p|}$, $\VV{AB} = \VV{OB} - \VV{OA}$
|
||||
\begin{center}
|
||||
\begin{multicols}{2}
|
||||
\begin{tikzpicture}[scale=0.8, every node/.style={transform shape}]
|
||||
\coordinate[label=below left:O] (O) at (0,0);
|
||||
\coordinate[label=A] (A) at (0.3,1.6);
|
||||
\coordinate[label=B] (B) at (1.5, 1.4);
|
||||
\coordinate[label=P] (P) at (1, 1.5);
|
||||
\draw (O)
|
||||
-- node[left] {$\vv{a}$} (A)
|
||||
-- node[above] {$\lambda$} (P)
|
||||
-- node[above] {$\mu$} (B)
|
||||
-- node[right] {$\vv{b}$} (O)
|
||||
-- node[left] {$\vv{p}$} (P);
|
||||
\end{tikzpicture}
|
||||
\\ \textbf{ratio theorem}
|
||||
\\* $\vv{p} = \frac{\mu\vv{a} + \lambda\vv{b}}{\lambda + \mu}$
|
||||
\newline
|
||||
\\ \textbf{midpoint theorem}
|
||||
\\* $\vv{p} = \frac{\vv{a} + \vv{b}}{2}$
|
||||
\end{multicols}
|
||||
\end{center}
|
||||
\subsection{Dot Product}
|
||||
\begin{itemize}
|
||||
\item $\VV{a} \cdot \VV{b} = a_1b_1 + a_2b_2 + a_3b_3 = |a||b|\cos\theta$
|
||||
\item $a \perp b \Then a \cdot b = 0$
|
||||
\item $a \parallel b \Then a \cdot b = |a||b|$
|
||||
\end{itemize}
|
||||
|
||||
\subsection{Cross Product}
|
||||
$\vv{a} \times \vv{b} = \begin{vmatrix}
|
||||
\vv{i} & \vv{j} & \vv{k} \\
|
||||
a_i & a_2 & a_3 \\
|
||||
b_i & b_2 & b_3
|
||||
\end{vmatrix} = \begin{pmatrix} (a_2b_3 - a_3b_2) \\ -(a_1b_3 - a_3b_1) \\ (a_1b_2 - a_2b_1) \end{pmatrix}$
|
||||
|
||||
\begin{center}
|
||||
\begin{multicols}{2}
|
||||
$|\vv{a} \times \vv{b}| = |\vv{a}||\vv{b}|\sin\theta$
|
||||
$a \perp b \Then a \times b = |a||b|$
|
||||
$a \parallel b \Then a \times b = 0$
|
||||
Parallelogram = $|\vv{a} \times \vv{b}|$
|
||||
\end{multicols}
|
||||
\end{center}
|
||||
|
||||
\subsection{Projection}
|
||||
\begin{multicols}{2}
|
||||
\begin{tikzpicture}[scale=0.7, every node/.style={transform shape}]
|
||||
\coordinate[label=below left:O] (O) at (0,0);
|
||||
\coordinate[label=right:A] (A) at (2, 1);
|
||||
\coordinate[label=below:B] (B) at (3, 0);
|
||||
\coordinate[label=below:N] (N) at (2, 0);
|
||||
\draw (A)
|
||||
-- node[above] {$\vv{a}$} (O)
|
||||
-- node[below] {$\vv{b}$} (B);
|
||||
\draw[shorten >=0pt, dashed] (A) -- (N);
|
||||
\end{tikzpicture}
|
||||
$\triangle ANO = \frac{1}{2} \abs{\VV{OA} \times \VV{ON}}$
|
||||
\columnbreak
|
||||
|
||||
$\text{comp}_{\vv{b}}\vv{a} = |\vv{b}|\cos\theta = \frac{\vv{a}\cdot \vv{b}}{|\vv{a}|}$
|
||||
$\text{proj}_{\vv{b}}\vv{a} = \text{comp}_{\vv{b}}\vv{a} \cdot \frac{a}{|a|} = \VV{ON} = \frac{\vv{a}\cdot \vv{b}}{\vv{a}\cdot \vv{a}}\vv{a} = \frac{\vv{a} \cdot \vv{b}}{|\vv{a}|^2}\vv{b}$
|
||||
\end{multicols}
|
||||
|
||||
\subsection{Lines}
|
||||
\begin{multicols}{2}
|
||||
$\vv{r} = \vv{r}_0 + t\vv{v} = \langle x,y,z\rangle$
|
||||
$\langle x_0,y_0,z_0\rangle + t\langle a,b,c\rangle$
|
||||
$\begin{pmatrix}
|
||||
x_0 + at \\
|
||||
y_0 + bt \\
|
||||
z_0 + ct \\
|
||||
\end{pmatrix}$
|
||||
\end{multicols}
|
||||
\subsection{Planes}
|
||||
$\vv{n} = \langle a, b, c \rangle, \vv{r} = \langle x, y, z \rangle,\vv{r}_0\langle x_0, y_0, c_0 \rangle$\\
|
||||
Scalar: $\vv{n} \cdot \vv{r} = \vv{n} \cdot \vv{r}_0$\\
|
||||
Cartesian: $ax + by + cz = d$
|
||||
\subsection{Distance from Point to Plane}
|
||||
$\frac{|ax_0 + by_0 + cz_0 - d|}{\sqrt{a^2 + b^2 + c^2}}$
|
||||
|
||||
\section{Partial Derivatives}
|
||||
\subsection{Chain Rule}
|
||||
For $z(t) = f(x(t), y(t))$,
|
||||
\\* $\frac{dz}{dt} = \frac{\partial z}{\partial x}\frac{dx}{dt} + \frac{\partial z}{\partial y}\frac{dy}{dt}$
|
||||
|
||||
For $z(s, t) = f(x(s,t), y(s,t))$,
|
||||
\\* $\frac{\partial z}{\partial t} = \frac{\partial z}{\partial x}\frac{\partial x}{\partial t} + \frac{\partial z}{\partial y}\frac{\partial y}{\partial t}$
|
||||
\\* $\frac{\partial z}{\partial s} = \frac{\partial z}{\partial x}\frac{\partial x}{\partial s} + \frac{\partial z}{\partial y}\frac{\partial y}{\partial s}$
|
||||
|
||||
Arc Length of $r(t)$: $\int^b_a |\vv{r}'(t)|dt$
|
||||
|
||||
\subsection{Implicit Differentiation}
|
||||
$\frac{\partial z}{\partial x} =- \frac{F_x}{F_z}$
|
||||
$\frac{\partial z}{\partial y} =- \frac{F_y}{F_z}$
|
||||
|
||||
\subsection{Directional Derivative}
|
||||
Gradient vector at $f(x,y): \triangle f = f_x\vv{i} + f_y\vv{j}$
|
||||
|
||||
$D_uf(x, y) = \langle f_x, f_y \rangle \cdot \langle a, b \rangle = \langle f_x, f_y\rangle \cdot \hat{\vv{u}} = \triangle f \cdot \hat{\vv{u}}$ (Unit Vector)
|
||||
|
||||
Tangent Plane: $\triangle f \cdot \langle x-x_0, y-y_0,z-z_0\rangle = 0$
|
||||
|
||||
\subsection{Critical Points}
|
||||
$D = f_{xx}(a,b)f_{yy}(a,b) - (f_{x,y}(a,b))^2$
|
||||
\def\arraystretch{1.2}
|
||||
\begin{tabular}{| c | c | c |}
|
||||
\hline $D$ & $f_{xx}(a,b)$ & \textbf{local}
|
||||
\\\hline + & + & \text{min}
|
||||
\\\hline + & - & \text{max}
|
||||
\\\hline - & \text{any} & \text{saddle point}
|
||||
\\\hline 0 & \text{any} & \text{no conclusion}
|
||||
\\\hline
|
||||
\end{tabular}
|
||||
\section{Double Integrals}
|
||||
\subsection{Type I}
|
||||
\begin{multicols}{2}
|
||||
\includegraphics[width=\linewidth]{Type I}
|
||||
\columnbreak
|
||||
|
||||
$\int^b_a\int^{g_2(x)}_{g_1(x)}f(x,y)dydx$
|
||||
\newline
|
||||
\newline
|
||||
$D = \{(x,y): a \leq x \leq b,$ $g_1(x) \leq y \leq g_2(x)\}$
|
||||
\end{multicols}
|
||||
\subsection{Type II}
|
||||
\begin{multicols}{2}
|
||||
\includegraphics[width=\linewidth]{Type II}
|
||||
\columnbreak
|
||||
|
||||
$\int^d_c\int^{h_2(y)}_{h_1(y)}f(x,y)dxdy$
|
||||
\newline
|
||||
\newline
|
||||
$D = \{(x,y): c \leq y \leq d,$ $ h_1(y) \leq x \leq h_2(y)\}$
|
||||
\end{multicols}
|
||||
|
||||
\subsection{Polar Coordinates}
|
||||
\begin{multicols}{2}
|
||||
\includegraphics[width=\linewidth]{polar}
|
||||
\columnbreak
|
||||
|
||||
$x = r\cos\theta$\\
|
||||
$y = r\sin\theta$\\
|
||||
$R = \{(r, \theta): 0 \leq a \leq r \leq b,$ $\alpha \leq \theta \leq \beta\}$
|
||||
\newline
|
||||
\newline
|
||||
$\int^\beta_\alpha\int^b_af(r\cos\theta, r\sin\theta)rdrd\theta$
|
||||
\end{multicols}
|
||||
|
||||
\subsection{Surface Area}
|
||||
$S = \iint_R\sqrt{f_x^2 + f_y^2 + 1} dA$
|
||||
|
||||
\section{ODE}
|
||||
\begin{tabular}{|>{\color{black}}c | >{\color{black}}c|}
|
||||
\hline
|
||||
form & change of variable \\
|
||||
\hline
|
||||
$\frac{dy}{dx} = f(x)g(y)$ & $\int \frac{1}{g(y)}dy = \int f(x)dx + C$\\
|
||||
\hline
|
||||
$y'=g(\frac{y}{x})$ & \makecell{Set $v = \frac{y}{x}$ \\ $\Then y' = v + xv' $}\\
|
||||
\hline
|
||||
\makecell{ $y'=f(ax + by + c)$\\ $\Then y' = \frac{ax+by+c}{\alpha x + \beta y + \gamma}$} & Set $v = ax+by$ \\
|
||||
\hline
|
||||
$y' + P(x)y = Q(x)$ & \makecell{$R = e^{\int P(x)dx}$ \\ $\Then y \cdot R = \int Q \cdot R dx $}\\
|
||||
$y' + P(x)y = Q(x)y^n$ & \makecell{$z = y^{1-n}$ \\ $\Then$ sub in Z \\ solve linear}\\
|
||||
\end{tabular}
|
||||
|
||||
|
||||
\end{multicols*}
|
||||
\end{document}
|
BIN
cheatsheets/ma1521/images/Type I.png
Normal file
BIN
cheatsheets/ma1521/images/Type I.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 149 KiB |
BIN
cheatsheets/ma1521/images/Type II.png
Normal file
BIN
cheatsheets/ma1521/images/Type II.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 203 KiB |
BIN
cheatsheets/ma1521/images/polar.png
Normal file
BIN
cheatsheets/ma1521/images/polar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 213 KiB |
@ -1,60 +0,0 @@
|
||||
import java.util.concurrent.RecursiveTask;
|
||||
|
||||
class MatrixMultiplication extends RecursiveTask<Matrix> {
|
||||
|
||||
/** The fork threshold. */
|
||||
private static final int FORK_THRESHOLD = 1024; // Find a good threshold
|
||||
|
||||
/** The first matrix to multiply with. */
|
||||
private final Matrix m1;
|
||||
|
||||
/** The second matrix to multiply with. */
|
||||
private final Matrix m2;
|
||||
|
||||
/** The starting row of m1. */
|
||||
private final int m1Row;
|
||||
|
||||
/** The starting col of m1. */
|
||||
private final int m1Col;
|
||||
|
||||
/** The starting row of m2. */
|
||||
private final int m2Row;
|
||||
|
||||
/** The starting col of m2. */
|
||||
private final int m2Col;
|
||||
|
||||
/**
|
||||
* The dimension of the input (sub)-matrices and the size of the output
|
||||
* matrix.
|
||||
*/
|
||||
private int dimension;
|
||||
|
||||
/**
|
||||
* A constructor for the Matrix Multiplication class.
|
||||
* @param m1 The matrix to multiply with.
|
||||
* @param m2 The matrix to multiply with.
|
||||
* @param m1Row The starting row of m1.
|
||||
* @param m1Col The starting col of m1.
|
||||
* @param m2Row The starting row of m2.
|
||||
* @param m2Col The starting col of m2.
|
||||
* @param dimension The dimension of the input (sub)-matrices and the size
|
||||
* of the output matrix.
|
||||
*/
|
||||
MatrixMultiplication(Matrix m1, Matrix m2, int m1Row, int m1Col, int m2Row,
|
||||
int m2Col, int dimension) {
|
||||
this.m1 = m1;
|
||||
this.m2 = m2;
|
||||
this.m1Row = m1Row;
|
||||
this.m1Col = m1Col;
|
||||
this.m2Row = m2Row;
|
||||
this.m2Col = m2Col;
|
||||
this.dimension = dimension;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Matrix compute() {
|
||||
// Modify this
|
||||
return Matrix.recursiveMultiply(m1, m2, m1Row, m1Col, m2Row, m2Col, dimension);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user