we know the ordinary way of calculation with the formula :
however the runtime of this algorithm is
if we calculating from the first elements to top it will be but with space complexity of because we need to create variables for calculation ,but we can do even better.
this formula is one way of calculation the -th element in fib series, the time complexity of raising a number to a power of is how ever when working with a irrational numbers there can be a miscalculations, even more when is a very large number.
to fix this we can use the following method-
we can improve the miscalculation by looking at and
as a vector and we will assume the following math equation (we can prove it with induction):
we can open this formula and we will get
because matrix multiplication is the entire calculation is just because raising to the power of numbers mentioned as above is .