Jump to content

Math Adventures/Pascal's triangle in wiki-latex

From Wikiversity

If you are writing for a wiki the supports Wikipedia's version of LaTeX for use with the HTML markup <math></math>, copy and modify the code listed below:

Basic triangle

[edit | edit source]

Basic triangle code

[edit | edit source]
<math>
\begin{array}{c}
1 \\
1 \quad 1 \\
1 \quad 2 \quad 1 \\
1 \quad 3 \quad 3 \quad 1 \\
1 \quad 4 \quad 6 \quad 4 \quad 1 \\
1 \quad 5 \quad 10 \quad 10 \quad 5 \quad 1 \\
1 \quad 6 \quad 15 \quad 20 \quad 15 \quad 6 \quad 1 \\
1 \quad 7 \quad 21 \quad 35 \quad 35 \quad 21 \quad 7 \quad 1 \\
\end{array}
 </math>

Combinations

[edit | edit source]

Combinations code

[edit | edit source]
<math>
\begin{array}{c}
                                       {\color{Red}\boldsymbol{1}}=\binom{0}{0} \\
                               {\color{Red}\boldsymbol{1}}=\binom{1}{0} \quad\quad{\color{Red}\boldsymbol{1}}=\binom{1}{1} \\
                       {\color{Red}\boldsymbol{1}}=\binom{2}{0} \quad\quad  {\color{Red}\boldsymbol{2}}=\binom{2}{1}                  
 \quad\quad{\color{Red}\boldsymbol{1}}=\binom{2}{2} \\
               {\color{Red}\boldsymbol{1}}=\binom{3}{0} \quad\quad  {\color{Red}\boldsymbol{3}}=\binom{3}{1} \quad\quad 
 {\color{Red}\boldsymbol{3}}=\binom{3}{2} \quad\quad\quad\quad {\color{Red}\boldsymbol{1}}=\binom{3}{3} \\ 
       {\color{Red}\boldsymbol{1}}=\binom{4}{0} \quad\quad  {\color{Red}\boldsymbol{4}}=\binom{4}{1} \quad\quad 
       {\color{Red}\boldsymbol{6}}=\binom{4}{2} \quad\quad  {\color{Red}\boldsymbol{4}}=\binom{4}{3} \quad\quad 
       {\color{Red}\boldsymbol{1}}=\binom{4}{4} \\
\end{array}
</math>

Binomial coefficients

[edit | edit source]

Binomial coefficients code

[edit | edit source]
<math>
\begin{array}{lc}
(a+b)^0= &
{\color{Red}\boldsymbol{1}} 
\\
(a+b)^1=  & 
{\color{Red}\boldsymbol{1}}a+{\color{Red}\boldsymbol{1}}b
\\
(a+b)^2=  &
{\color{Red}\boldsymbol{1}}a^2+{\color{Red}\boldsymbol{2}}ab+{\color{Red}\boldsymbol{1}}b^2
\\
(a+b)^3=  &
{\color{Red}\boldsymbol{1}}a^3+{\color{Red}\boldsymbol{3}}a^2b+{\color{Red}\boldsymbol{3}}ab^2+{\color{Red}\boldsymbol{1}}b^3
\\
(a+b)^4=  &
{\color{Red}\boldsymbol{1}}a^4+{\color{Red}\boldsymbol{4}}a^3b+{\color{Red}\boldsymbol{6}}a^2b^2+{\color{Red}\boldsymbol{4}}ab^3+ {\color{Red}\boldsymbol{1}}b^4
\\                                     
\end{array}
</math>

Making them act as images

[edit | edit source]
The first six rows of Pascal's triangle

If you want your equations to seem like images posted from commons use this trick:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

<div class="thumb tright"><div style="width:370px;"><math>
\begin{array}{lc}
(a+b)^0= &
{\color{Red}\boldsymbol{1}} 
\\
(a+b)^1=  & 
{\color{Red}\boldsymbol{1}}a+{\color{Red}\boldsymbol{1}}b
\\
(a+b)^2=  &
{\color{Red}\boldsymbol{1}}a^2+{\color{Red}\boldsymbol{2}}ab+{\color{Red}\boldsymbol{1}}b^2
\\
(a+b)^3=  &
{\color{Red}\boldsymbol{1}}a^3+{\color{Red}\boldsymbol{3}}a^2b+{\color{Red}\boldsymbol{3}}ab^2+{\color{Red}\boldsymbol{1}}b^3
\\
(a+b)^4=  &
{\color{Red}\boldsymbol{1}}a^4+{\color{Red}\boldsymbol{4}}a^3b+{\color{Red}\boldsymbol{6}}a^2b^2+{\color{Red}\boldsymbol{4}}ab^3+ {\color{Red}\boldsymbol{1}}b^4
\\                                     
\end{array}
</math><div class="thumbcaption">The first six rows of Pascal's triangle</div></div></div>

If you want your equations to seem like images posted from commons use this trick:

{{Lorem ipsum|1}}{{clear}}