To add and take scalar multiples of quaternions just treat them like 4-dimensional vectors, for example:
(a1 +b1i + c1j + d1k) + (a2 +b2i + c2j + d2k) = (a1+a2) + (b1+b2)i + (c1+c2)j + (d1+d2)k).
Multiplication is defined by the rules of ordinary algebra where
i2=j2=k2 = -1,    i j = k = -j i,     j k = i = -k j,    and    k i = j = -i k.
For example
(2 + 3i +4j +5k)(6 + 7i + 8j + 9k) = (12 - 21 - 32 - 45) + (36-40)i + (35-27)j + (21 - 28)k = -86 - 4i +8j -7 k.
To read about number systems, where quaternions fit in, why there are no three-dimensional numbers and numbers in higher dimensions, see the NRICH article What Are Numbers?