### Pascal's Triangle

For a computer programmer, an interesting way to understand Pascal's triangle is to look at it as describing strings of n bits, where n is a row of the triangle.

The first and the last elements in the row, which are always one, are the number of ways to have all bits zero or all bits one, which is naturally just one way. The second element and the second-to-last element are the number of ways to have one bit on, and the number of ways to have all but one bit on. These are always going to be equal to the length of the string, or, in other words, the row number. That is because if your string is, say, three bits, you can have bit zero on, bit one on, or bit two on: three ways to have one bit turned on:

``` ```
``` 100            010           001 ```
``` ```

And so on.

This of course very easily makes clear that the numbers in row n will add up to 2n: that is how many numbers you can represent with a string of n bits!
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}