Camille Scott
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # ECS132 LaTeX Math Reference LaTeX can be daunting to get started with, and the documentation dense. I put this notepad together to demo a subset of LaTeX relevant to the course; and because it's on HackMD, it also demos some Markdown at the same time. I hope it helps you out! ## Entering Math Mode To enter math mode, surround your LaTeX code with `$` for inline and `$$` for long form. For example, `$P$` gives you $P$, while `$$P$$` will put it on its own line. You can also use the LaTeX commands directly: ``` \begin{equation} P(X) \end{equation} ``` renders as: \begin{equation*} P(X) \end{equation*} Most Markdown-based editors -- like Jupyter -- will recognize both forms. ## Some Simple Equations Many basic equations don't require any special syntax. Upper-case letters will be converted to their "mathy" formats, and operations and symbols will be properly spaced. * `$P(A)-1$`: $P(A)-1$ * `$P(A)+P(B)$`: $P(A)+P(B)$ * `$P(A)P(B)$`: $P(A)P(B)$ Some symbols need to be escaped with `\` because they have special meaning to LaTeX. For example, curly braces: `$S = \{1,2,3,4,5,6\}$`: $S = \{1,2,3,4,5,6\}$. Some operations have special commands. For example, the "x" **multiplication** symbol is invoked with `\times`: `$A \times B$` gives $A \times B$. ## Subscripts and Superscripts **Subscripts** are defined with `_` and **superscripts** with `^`. For example: * `$A_i$`: $A_i$ * `$A^i$`: $A^i$ If the sub or superscript has multiple symbols, it needs to be fenced with `{}`. * `$(1-p)^{k-1}$`: $(1-p)^{k-1}$ * `$A_{i-1}$`: $A_{i-1}$ ## Fractions Long-form **fractions** use the `\frac{}{}` command: the numerator goes in between the first braces and denominator in the second. For example, `$$\frac{n!}{(n-k)!k!}$$` gives you: $$\frac{n!}{(n-k)!k!}$$ For **fractions with braces**, we can use the `\left(` and `\right)` commands. Note that both are necessary. For example, `$$\left( \frac{n-1}{n} \right)^(k-1)$$` gives: $$\left( \frac{n-1}{n} \right)^{k-1}$$ Also note that I threw an exponent on there by tacking on `^{k-1}` -- LaTeX is smart enough to apply it to the entire braced expression. ## Counting **Counting** notation works similarly, but the command is either `\choose` or `\binom{}{}`. For example, `$$\binom{n}{k}$$` gives: $$\binom{n}{k}$$ and we get the same with `$$n \choose k$$`: $$n \choose k$$ Note that, with `\choose`, we need to wrap it in braces if there are other terms in order to avoid ambiguity. So, more precisely, we should do `$${n \choose k}$$`. ## Set Notation We use **intersection** and **union** a lot in this class! These two symbols, like many other math operators, have their own commands: * Union is `\cup`, like `$A \cup B$`: $A \cup B$ * Intersection is `\cap`, like `$A \cap B$`: $A \cap B$ We also want to be able to donate **membership**. * "Is an element of" is `\in`, like `$a_i \in A$`: $a_i \in A$ * "Is not an element of" is `\notin`, like `$x \notin A$`: $x \notin A$ And of course, sub- and supersets: * "Is a subset of" is `\subseteq`, like `$V \subseteq W$`: $V \subseteq W$ * "Is a *proper* subset of" is `\subset`, like `$V \subset W$`: $V \subset W$ ## Comparisons The comparison operators follow a somewhat standard format, with **equals**, **less than**, and **greater than** using their raw symbols and the combined operators having their own commands: * **equals** uses the raw symbol `=`: `$A = B$` gives $A = B$ * **less than** uses the raw symbol `<`: `$A < B$` gives $A < B$ * **greater than** uses the raw symbol `>`: `$A > B$` gives $A > B$ * **less than or equal to** uses `\leq` or `\leq`: `$A \leq B$` gives $A \leq B$ * **greater than or equal to** is similar, `\geq` or `ge`: `$A \geq B$` gives $A \geq B$ * **not equal to** is, you guess it, `\neq`: `$A \neq B$` gives $A \neq B$ The [On-Line Encyplopedia of Integer Sequences](https://oeis.org/wiki/List_of_LaTeX_mathematical_symbols) has a nice chart of many additional unary and binary operators for your reference. ## Additional Notation The **complement** symbol has its own command, `\complement`. We can use it along with the superscript command like so: * `$P(A^\complement) = 1 - P(A)$`: $P(A^\complement) = 1 - P(A)$ **Conditional** probability uses a raw pipe `|` symbol. So `$$P(A|B) = \frac{P(A)P(B|A)}{P(B)}$$` (Baye's Rule!) gives: $$P(A|B) = \frac{P(A)P(B|A)}{P(B)}$$ ## Compound Operators **Summation** combines the sub and superscript syntax with its own command `\sum`. Intuitively, below the sum uses subscript, and above uses superscript. For example, `$$\sum_{i=0}^{10} n_i$$` gives: $$\sum_{i=0}^{10} n_i$$ **Products** work similarly. For example, `$$\prod_{i=0}^{k} n-i$$` gives: $$\prod_{i=0}^{k} n-i$$ **Integration** uses the `\int` command; `$$\int_{a}^{\infty} f_X (x) dx$$` gives: $$\int_{a}^{\infty} f_X (x) dx$$ Note how I slipped in that `\infty` to get $\infty$. ## Going Further Note that all of these commands can be combined together! Just make sure to keep track of how many braces you've used -- just like in any other programming language (and yes, depressingly, LaTeX is Turing-complete), things will go haywire if you mismatch braces. Some examples: * `\frac` and `\binom`: `$$\frac{1}{\binom{52}{13}}$$` gives $$\frac{1}{\binom{52}{13}}$$ ### Equation Arrays We can create (semi)-aligned arrays of equations with the `\eqnarray` command: ``` \begin{eqnarray} a & = & b + c \\ x & = & y - z \end{eqnarray} ``` $$ \begin{eqnarray} a & = & b + c \\ x & = & y - z \end{eqnarray} $$ The `&` acts as a column-separator within each row, setting the alignment; the `\\` denotes the end of a row. ### Explicit Bracket Sizes Sometimes you want finer control over bracket sizes. This can be achieved with the "big" family of commands: `$$\big\{ \big\} \Big\{ \Big\} \bigg\{ \bigg\} \Bigg\{ \Bigg\}$$` renders as: $$\big\{ \big\} \Big\{ \Big\} \bigg\{ \bigg\} \Bigg\{ \Bigg\}$$ Stick whichever sort of bracket after the `\big` as you want; for example, you can make a really big pipe with `$\Bigg|$`: $\Bigg|$ ## Additional Resources * **Detexify**: Martin pointed out this great resource that allows you to draw a symbol which will be run through a classifier to guess the appropriate command: https://detexify.kirelabs.org/classify.html. There is also an [Android app on the Play Store](https://play.google.com/store/apps/details?id=website.marty.detexify&hl=en_US&gl=US).

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully