LogoLogo
Terminal
  • Attic Lab
  • Getting Started
  • Crest Gold
  • Crest Silver
  • Videos on Computation
  • PI PICO (CIRCUITPYTHON)
    • Getting Started
    • Pin Out Diagram
    • Breadboards
    • 1. Led Blink
    • 2. RGB
    • 3. OLED
    • 4. Sensors
    • 5. Wifi
    • 6. Servos
  • Arduino
    • Getting Started
    • Pin Out Diagrams
      • Mega2560 R3
    • Programming
      • Arduino C - Cheat Sheet
    • Buttons
      • Momentary Switches
    • Display
      • LEDs
      • 7 Segment Displays
      • LCD Displays (GPIO)
      • LCD Displays (SPI)
      • OLEDs
    • Communication
      • Antenna Theory
      • Lora
      • Wifi
        • Boards
    • Project Ideas
    • Motion
      • DC Motors
      • Servo Motors
      • Stepper Motors
  • Microsoft Office
    • Word
    • Powerpoint
    • Excel
  • The Terminal
    • Basics
    • Cheat Sheet
    • Games
      • Level 1 - Bashcrawl
      • Level 2 - Bandit
  • TinkerCad
    • Gallery
    • Getting Started
    • Basic Operations
    • Basic Skills
    • Projects
      • Locking Container
  • Python
    • Hello World
    • Turtle Graphics
      • Strings in Turtle Graphics
      • Cheat Sheet
    • Variables
    • Loops
    • If Statements
    • Functions
    • Games
      • Pong
  • Raspberry Pi
    • Setup
      • Changing The Hostname
      • Headless Setup
      • Kiosk Mode
    • Remote Connections
    • Displays
      • Memory
        • External HD
      • HyperPixel 4.0
  • Ultimaker 3D Printing
    • The Thingiverse
    • Preparing the File
    • Printing
    • Calibration Prints
    • Print Set
  • Fusion 360
    • Getting Started
    • Design Tutorials
      • Tweezers
      • Mars Rover Wheel
    • Surface Modeling
  • Electronics
    • References
    • Antenna Theory
    • LoRa
  • PCB Milling
    • FlatCam
    • Candle
    • PCB Milling
  • Projects
  • Projects
    • Star Map Necklace
    • Ideas Respository
  • Latex
    • What is LaTeX?
    • Getting Started
    • Structure
    • Page Size & Margins
    • Styling
    • Images
    • Lists
    • Tables
    • Mathematics
      • Superscript and Subscripts
      • List of Symbols
      • Fractions and Binomials
      • Integrals, Sums & Limits
    • Colors
  • Web Development
    • The Internet
    • Intro to HTML
    • Basic Elements
    • Basic Styling
Powered by GitBook
On this page
  • Displaying fractions
  • Continued fractions
  • Binomial coefficients
  • Reference guide

Was this helpful?

  1. Latex
  2. Mathematics

Fractions and Binomials

PreviousList of SymbolsNextIntegrals, Sums & Limits

Last updated 3 years ago

Was this helpful?

Using fractions and binomial coefficients in an expression is straightforward.

The binomial coefficient is defined by the next expression:

\[
    \binom{n}{k} = \frac{n!}{k!(n-k)!}
\]
FractionsBinomialEx1edit.PNG

For these commands to work you must import the package amsmath by adding the next line to the preamble of your file

\usepackage{amsmath}

Displaying fractions

The appearance of the fraction may change depending on the context

Fractions can be used alongside the text, for 
example \( \frac{1}{2} \), and in a mathematical 
display style like the one below:

\[\frac{1}{2}\]

As you may have guessed, the command \frac{1}{2} is the one that displays the fraction. The text inside the first pair of braces is the numerator and the text inside the second pair is the denominator.

Also, the text size of the fraction changes according to the text around it. You can set this manually if you want.

When displaying fractions in-line, for example \(\frac{3x}{2}\) 
you can set a different display style: 
\( \displaystyle \frac{3x}{2} \).

This is also true the other way around

\[ f(x)=\frac{P(x)}{Q(x)} \ \ \textrm{and} 
\ \ f(x)=\textstyle\frac{P(x)}{Q(x)} \]

The command \displaystyle will format the fraction as if it were in mathematical display mode. On the other side, \textstyle will change the style of the fraction as if it were part of the text.

Continued fractions

The usage of fractions is quite flexible, they can be nested to obtain more complex expressions.

The fractions can be nested

\[ \frac{1+\frac{a}{b}}{1+\frac{1}{1+\frac{1}{a}}} \]

Now a wild example

\[
  a_0+\cfrac{1}{a_1+\cfrac{1}{a_2+\cfrac{1}{a_3+\cdots}}}
\]

Binomial coefficients

Binomial coefficients are common elements in mathematical expressions, the command to display them in LATEX is very similar to the one used for fractions.

The binomial coefficient is defined by the next expression:

\[
    \binom{n}{k} = \frac{n!}{k!(n-k)!}
\]

And of course this command can be included in the normal 
text flow \(\binom{n}{k}\).

As you see, the command \binom{}{} will print the binomial coefficient using the parameters passed inside the braces.

Reference guide

A slightly different and more complex example of continued fractions

Final example

\newcommand*{\contfrac}[2]{%
{
  \rlap{$\dfrac{1}{\phantom{#1}}$}%
  \genfrac{}{}{0pt}{0}{}{#1+#2}%
}
}
\[
  a_0 +
  \contfrac{a_1}{
  \contfrac{a_2}{
  \contfrac{a_3}{
  \genfrac{}{}{0pt}{0}{}{\ddots}
  }}}
\]
FractionsBinomialsEx2.png
FractionsBinomialsEx3.png
FractionsBinomialsEx4.png

The second fraction displayed in the previous example uses the command \cfrac{}{} provided by the package amsmath (see the ), this command displays nested fractions without changing the size of the font. Specially useful for continued fractions.

FractionsBinomialsEx6.png
introduction