IT103: Algebra

Unit 1: Introduction to the basics

R Batzinger

2024-07-12

Module 1: Introduction to Basics

Reading numbers

  • Numbers are split in English in units of 3 digits often marked off by commas

\[\tiny\begin{matrix}number:& 123,&456,&789,&123.&55\\ unit\ name:&billion,& million, & thousand, & - & and\ hundredths \\ \end{matrix}\]

  • within each units, the leading is associated to hundreds of the unit

\[\tiny\begin{matrix} 1&2&3&,\\ one\ hundred& twenty-&three&billion,\\ 4&5&6&,\\ four\ hundred & fifty- & six& million,\\ 7&8&9&,\\ seven\ hundred& eight-&nine& thousand,\\ 1&2&3&.\\ one\ hundred& twenty-&three& and\\ 55\\ &fifty-five\ hundredths\\ \end{matrix}\]

  • Use [and] at the position of the decimal point.
  • Putting it all together: (Note the use of punctuation (dashes and comma))

One hundred twenty-three billion, four hundred fifty-six million, seven hundred eight-nine thousand, one hundred twenty-three and fifty-five hundredths

Odometer

  • The number of places are fixed
  • Place holders are used in the leading blanks
  • As each place is filled from left to right until the odometer is full
  • Any attempt to add after the odometer full will be an error: (Overflow error)

\[\begin{matrix} \hline 00 \\ \hline 01 \\ \hline 02 \\ \hline 03 \\ \hline 04 \\ \hline 05 \\ \hline 06 \\ \hline 07 \\ \hline 08 \\ \hline 09 \\ \hline 10 \\ \hline 11 \\ \hline 12 \\ \hline 13 \\ \hline 14 \\ \hline 15 \\ \hline 16 \\ \hline 17 \\ \hline 18 \\ \hline 19 \\ \hline 20 \\ \hline 21 \\ \hline 22 \\ \hline 23 \\ \hline 24 \\ \hline 25 \\ \hline 26 \\ \hline 27 \\ \hline 28 \\ \hline 29 \\ \hline 30 \\ \hline 31 \\ \hline 32 \\ \hline 33 \\ \hline 34 \\ \hline 35 \\ \hline 36 \\ \hline 37 \\ \hline 38 \\ \hline 39 \\ \hline 40 \\ \hline 41 \\ \hline 42 \\ \hline 43 \\ \hline 44 \\ \hline 45 \\ \hline 46 \\ \hline 47 \\ \hline 48 \\ \hline 49 \\ \hline 50 \\ \hline 51 \\ \hline 52 \\ \hline 53 \\ \hline 54 \\ \hline 55 \\ \hline 56 \\ \hline 57 \\ \hline 58 \\ \hline 59 \\ \hline 60 \\ \hline 61 \\ \hline 62 \\ \hline 63 \\ \hline 64 \\ \hline 65 \\ \hline 66 \\ \hline 67 \\ \hline 68 \\ \hline 69 \\ \hline 70 \\ \hline 71 \\ \hline 72 \\ \hline 73 \\ \hline 74 \\ \hline 75 \\ \hline 76 \\ \hline 77 \\ \hline 78 \\ \hline 79 \\ \hline 80 \\ \hline 81 \\ \hline 82 \\ \hline 83 \\ \hline 84 \\ \hline 85 \\ \hline 86 \\ \hline 87 \\ \hline 88 \\ \hline 89 \\ \hline 90 \\ \hline 91 \\ \hline 92 \\ \hline 93 \\ \hline 94 \\ \hline 95 \\ \hline 96 \\ \hline 97 \\ \hline 98 \\ \hline 99 \\ \hline \end{matrix}\]

Binary Odometer

\[\begin{matrix} \hline 0 & 0000 \\ \hline 1 & 0001 \\ \hline 2 & 0010 \\ \hline 3 & 0011 \\ \hline 4 & 0100 \\ \hline 5 & 0101 \\ \hline 6 & 0110 \\ \hline 7 & 0111 \\ \hline 8 & 1000 \\ \hline 9 & 1001 \\ \hline 10 & 1010 \\ \hline 11 & 1011 \\ \hline 12 & 1100 \\ \hline 13 & 1101 \\ \hline 14 & 1110 \\ \hline 15 & 1111 \\ \hline \end{matrix}\]

Range of possible numbers

\[\tiny\begin{matrix}Number\ type & Minimum / Maximum & Bits \\ \hline int: & -2147483648 & 31\\ & 2147483647 & \\ \hline unsigned\ int: & 0 & 32\\ & 4294967295 & \\ long long:& -9223372036854775808 &63\\ & 9223372036854775807 & \\ unsign long long: & 0 & 64 \\ & 18446744073709551615 & \\ float: & 1.175494e-38 & 32\\ & 3.402823e+38 & \\ double: & 2.225074e-308 & 64\\ 0 &1.797693e+308 & \\ long double: & 3.362103e-4932 &128\\ & 1.189731e+4932 & 0 \\ \end{matrix}\]

Precision

p = 3.1415926535897932384626433
formatted_x <- format(p, digits = 20)
print(formatted_x)
[1] "3.141592653589793116"

Decoding Numbers

\[\begin{matrix} 1 & 2 & 3 & 4 & \\ | & | & | & | & \\ | & | & | & 1 & \rightarrow & 1\times 4 & =& 4 \\ | & | & 10 & - & \rightarrow & 10 \times 3 &=& 30\\ | & 100 & - & - &\rightarrow & 100\times 2 &=& 200 \\ 1000 & - & - & - &\rightarrow & 1000 \times 1 &= & 1000\\ & & & & & & & 1,234 \\ \end{matrix}\]

Decoding Binary Numbers

\[\begin{matrix} 1 & 0 & 1 & 1 & \\ | & | & | & | & \\ | & | & | & 1 & \rightarrow & 1\times 1 & =& 1 \\ | & | & 2 & - & \rightarrow & 2 \times 1 &=& 2 \\ | & 4 & - & - &\rightarrow & 4\times 0 &=& 0 \\ 8 & - & - & - &\rightarrow & 8 \times 1 &= & 8\\ & & & & & & & 11 \\ \end{matrix}\]

\[\begin{matrix} 0 & 1 & 0 & 1 & \\ | & | & | & | & \\ | & | & | & 1 & \rightarrow & 1\times 1 & =& 1 \\ | & | & 2 & - & \rightarrow & 2 \times 0 &=& 0 \\ | & 4 & - & - &\rightarrow & 4\times 1 &=& 4 \\ 8 & - & - & - &\rightarrow & 8 \times 0 &= & 0\\ & & & & & & & 5 \\ \end{matrix}\]

1.1 Real Numbers

There is \(\infty\) values between 0 and 1.

\[\tiny\eqalign{0.0& & & & & & & & & & & & & & & & & & & & 2.0\\ 0.0& & & & & & & & & &1.0 & & & & & & & & & & 2.0\\ 0.0&& 0.2 && 0.4 && 0.6 && 0.8 && 1.0 && 1.2 && 1.4 && 1.6 && 1.8 && 2.0 \\ 0.0&0.1& 0.2 &0.3& 0.4 &0.5& 0.6 &0.7& 0.8 &0.9& 1.0 &1.1& 1.2 &1.3& 1.4 &1.5& 1.6 &1.7& 1.8 &1.9& 2.0 \\ 0.0&....&.... &....&.... &....& .... &....&.... &....&1.0& ....&.... &....&.... &....& .... &....&.... &....&2.0\\ }\]

Properties of Real numbers

Property Addition Multiplication
Commutative \(a+b = b+a\) \(a \times\ b = b \times a\)
Associative \(a+(b+c) = (a+b)+c\) \(a(bc) = (ab)c\)
Distributive \(a(b+c) = ab + ac\)
Identity \(a + 0 = a\) \(a \times 1 = a\)
Inverse \(a - a = 0\) \(a\times\left( \frac{1}{a}\right)\)

Computational speed: an experiment

  • Set 1: Time addition by a sequencial one by one acculmulated value.

3 3 7 7 5 4 6 4 3 4 3 7 6 5 7 3 6 7 4 3 5 5 6 7 7 5

  • Set 2: Time using addition by counting the number of each value and using multiplication count

3 6 4 5 7 3 4 5 3 7 3 5 6 4 7 7 4 5 7 3 7 7 5 3 6 6

  • Set 3: Time the addition by recursive pairing of numbers.

4 7 4 3 7 3 6 5 6 7 5 3 3 7 4 3 5 7 6 7 7 5 6 4 5 3

  • Each set is a randomized sequence of a set of numbers that totals as 132 based on the properties of numbers

  • All three methods will result in the same answer but have different computing times.

dat = c(rep(3,6),rep(4,4),rep(5,5),rep(6,4),rep(7,7))
dat[sample(26)]
 [1] 5 6 4 3 7 7 5 3 5 4 7 3 7 4 6 5 7 6 5 3 3 4 6 7 7 3
sum(dat)
[1] 132

1.2 Exponents and Scientific Notation

\[\eqalign{1,234.5678\\ 1.2345678&\times&\quad10^3\\ 12345678&&\quad E 3\\ Mantissa&&Exponent} \]

Multiplication of scientific numbers

The solution is a new mantissa that is the product of the mantissa and an exponent which is the sum of the exponents

\[\small(m_1 \times 10^{e1}) \times (m_2 \times 10^{e2}) = (m_1 \times m_2) \times 10^{(e1+e2)}\]

\[\small\eqalign{e_{mn} &=& min(e_1,e_2)\\ result &=& (m_1\times 10^{e_1-e_{mn}} + m_2\times 10^{e_2-e_{mn}})\times 10^{e_{mn}}\\}\]

\[\eqalign{ 5.1\times10^{-1} \times 3.32 \times 10^{2}\\ (5.1 \times 3.32)\times 10^{-1+2}\\ 16.881 \times 10^{-1}\\ 1.6881 \times 10^0\\ 1.6881\\}\]

Other examples of multiplication

\[\eqalign{(1.035 \times 10^3) \times (1.000 \times 10^5)\\ 1.035 \times 10^8\\}\]

\[\eqalign{(2.5 \times 10^1) \times (5.0 \times 10^2)\\ 12.5 \times 10^3\\ 1.25 \times 10^4\\}\]

Addition of numbers in scientific notation

  • Convert the numbers to the minimum exponent

  • Add the mantissa of the converted numbers

  • Reconvert the numbers to standard form {.scrollable}

\[\small\eqalign{e_{mn} &=& min(e_1,e_2)\\ result &=& (m_1\times 10^{e_1-e_{mn}} + m_2\times 10^{e_2-e_{mn}})\times 10^{e_{mn}}\\}\] \[\eqalign{ 5.1\times10^{-1} + 3.32 \times 10^{1}\\ (5.1 + 332.0)\times10^{-1}\\ 337.1 \times 10^{-1}\\ 3.371 \times 10^1\\ }\]

Other examples of addition

\[\eqalign{(2.5 \times 10^1) + (5.0 \times 10^2)\\ (2.5 \times 10^1) + (50 \times 10^1)\\ (2.5 + 50) \times 10^1\\ 52.5 \times 10^1\\ 5.25 \times 10^2\\}\]

\[\eqalign{2.2 \times 10^{-1} + 1.256 x 10^2\\ 2.2 \times 10^{-1} + 1256 \times 10^{-1} + 1.256 x 10^2\\ (2.2 + 1256) \times 10^{-1}\\ 1258.2 \times 10^-1\\ 1.2582 \times 10^{2} }\]

1.3 Radicals and Rational Exponents

\[\sqrt{a}\sqrt{b} = \sqrt{ab}\]

\[\eqalign{\sqrt{36}&=&6\\ \sqrt{36}=\sqrt{4}\sqrt{9}&=&2\times 3 = 6\\}\]

\[\sqrt{25-9}=\sqrt{16}=4\]

\[\sqrt{75}=\sqrt{3 \times 25}= 5\sqrt{3}\]

Exponents continues

\[b\,b\,b\,b = b^2\,b^2 = b\,b^3= b^4\]

\[2^{\frac{1}{2}} = \sqrt{2}\] \[2^{\frac{1}{3}} = \sqrt[3]{2}\] \[2^{\frac{1}{4}} = \sqrt[4]{2}\]

Examples

\[\eqalign{ \sqrt{100}&=& 10\\ \sqrt{\sqrt{16}} &=& 2\\ \sqrt{25 + 144} &=& 13\\ \sqrt{81} - \sqrt{49}&=& 9 - 7 = 2\\} \]

Negative and imaginary numbers

\[\sqrt{-1} = i\]

\[i^2 = -1\]

1.4 Polynomials

\[y = a_0 + a_1\,x + a_2\,x^2+a_3\,x^3 + a_n\,x^n\]

\[y = (x + 1)^n\]

1.5 Factoring Polynomials

\[\eqalign{y &=& (x +b)(x +d)\\ &=& x^2 + (b+d)x + bd\\}\]

\[\eqalign{y&=& (x+a)(x +a)\\ &=&x^2 + 2ax + a^2\\}\]

\[\eqalign{y&=& (x - a)(x + a &=&x^2 - a^2\\}\]

\[y=(x+1)^n\] ## Pascal Triangle

\[\tiny\begin{matrix} & & & & & & & & 1& & & & & & & & \\ & & & & & & & 1& & 1& & & & & & & \\ & & & & & & 1& & 2& & 1& & & & & & \\ & & & & & 1& & 3& & 3& & 1& & & & & \\ & & & & 1& & 4& & 6& & 4& & 1& & & & \\ & & & 1& & 5& &10& &10& & 5& & 1& & & \\ & & 1& & 6& &15& &20& &15& &6 & &1 & & \\ & 1& & 7& &21& &35& &35& &21& &7 & &1 & \\ 1 & &8 & &28& &56& &70& &56& &28& &8 & &1 \\ \end{matrix}\] * common units * square of a sum * square of a difference * parameters of the exponents of a sum

Polynomial Division

\[\small\eqalign{&\quad 2x^2 + 2x + 2\color{red}{\leftarrow Ans}\\ x + 2 &)\overline{\ 2x^3 + 6x^2 + 6x + 16 \ }\\ &\quad \underline{2x^3 + 4x^2}\\ &\quad \phantom{2x^3+\ }2x^2+6x\\ &\quad \phantom{2x^3+\ }\underline{2x^2+4x}\\ &\quad \phantom{2x^3+4x^2+\ }2x+16\\ &\quad \phantom{2x^3+4x^2+\ }\underline{2x+\ 4}\\ &\quad \phantom{2x^3+4x^2+2x+\ }12\color{red}{\leftarrow R}\\ }\]

1.6 Rational Expressions

\[\small\frac{x^2-2x-15}{x^2-9} = \frac{(x-5)(x+3)}{(x+3)(x-3)} = \frac{x-5}{x-3}\]

\[\frac{x^3-2x^2+x}{x^2-x}=\frac{x(x-1)^2}{x(x-1)}=x-1\] \[\frac{x^3-2x^2-15x}{x^2+5x+6}=\frac{x(x-5)(x+3)}{(x+2)(x+3)}=\frac{x(x-5)}{x+2}\]

\[\frac{x^3-19x-30}{x^2+5x+6}= \frac{(x-5)(x+3)(x+2)}{(x+2)(x+3)} = x-5\]

1.7 The basic rules of algebra

Rule 1:

Whatever you do on one side of the equal sign, do on the other.

\[\eqalign{x -5&=&0\\ x -5 {\bf\color{Blue}{+5}} &=& 0 {\bf\color{Blue}{+5}}\\ x &=& 5}\]

\[\eqalign{\frac{1}{x}&=&\frac{1}{2}\\ \frac{1\bf\color{Blue}{\times 2x}}{x} &=& \frac{1\bf\color{Blue}{\times 2x}}{2}\\ 2 &=& x}\]

Rule 2:

  • Whatever you do to the numerator, do to the denominator

\[\eqalign{\frac{1}{\frac{1}{2}} &=& x\\ \frac{1{\bf\color{Blue}{\times 2}}}{\frac{1}{2}{\bf\color{Blue}{\times 2}}} &=& x\\ 2&=&x\\}\]

Examples

\[\eqalign{\frac{6}{x} &=& \frac{2}{5}\\ \frac{6\color{red}{(5x)}}{x\color{red}{(2)}} &=& \frac{2\color{red}{(5x)}}{5\color{red}{(2)}}\\ 15 &=&x}\]

\[\eqalign{\frac{6}{x} &=& \frac{2}{5}\\ \frac{x}{6} &=& \frac{5}{2}\\ \frac{x\color{red}{(6)}}{6} &=& \frac{5\color{red}{(6)}}{2}\\ x &=& 15\\}\]

Another example

\[\eqalign{\frac{x+4}{5} &=&\frac{x+2}{3}\\ \frac{(x+4)\color{red}{(15)}}{5} &=&\frac{(x+2)\color{red}{(15)}}{3}\\ (3x +12) \color{red}{-(10-3x)}&=&(5x +10)\color{red}{-(10-3x)}\\ 2\color{red}{(0.5)} &=&2x\color{red}{(0.5)}\\ 1 &=& x\\}\]

Difference of Cubes

\[\eqalign{(x-a)(x^2+ax+a^2) &=& x^3 + ax^2 + a^2x - ax^2 - a^2x -a^3\\ &=& x^3 - a^3\\}\]

Sum of Cubes

\[\eqalign{(x+a)(x^2-ax+a^2) &=& x^3 - ax^2 + a^2x + ax^2 + a^2x +a^3\\ &=& x^3 + a^3\\}\]

Rules about exponents

\[\eqalign{Product:\quad & a^m \times a^n&=& a^{(m+n)}\\ Quotient:\quad & \frac{a^m}{a^n} &=& a^{(m-n)}\\ Power:\quad & (a^m)^n &=& a^{m\cdot n}\\ Zero\ exponent:\quad& a^0 &=& 1 \\ Negative:\quad & a^{-n} &=& \frac{1}{a^n}\\ Power\ of\ Product:\quad & (a\cdot b)^n &=& a^n \cdot b^n\\}\]