30 Formulas to improve your coding

Kaivalya Vanguri
4 min readFeb 12, 2024

--

If you can’t read this. Click on the friend link.

This is a list I have gathered from many sources and renowned books, and it comprises the most repeated and popular formulas that are a must-know for an average coder. To the best of my knowledge, and from my humble experience, I have gathered some formulae to boost your coding strategies in any programming language or become a competitive programmer. It is not an exhaustive list, but I am sure this will help most beginners.

Note: I do not support by-hearting formulae, but this serves the purpose of a glossary.

  1. Sum of natural numbers (Sₙ)
n stands for the last term

2. Sum of squares of natural numbers (Sₙ)

n is the last term of the series

3. Sum of cubes of natural numbers (Sₙ)

n is the last term

4. Sum of Geometric or exponential series of infinite numbers

a = first term and r = common ratio

5. Sum of Telescoping series — each term is added exactly once and subtracted out exactly once.

a1 is the first term and aₙ the nth term

6. Sum of Geometric or Exponential Series

where a is the first term and r the common ratio

7. Sum of Arithmetic Progression:

a is the first term and l the last term and n is the number of terms in the series

8. Pythagorean theorem:

where a,b,c are sides of a right-angled triangle

9. Quadratic Equation:

for ax²+bx+c=0 equation

10. Exponential Growth/Decay:

where e is a natural number and P₀ is a constant

11. Sine Rule:

a,b,c are the sides and A,B,C are the angles opposite to the respective sides

12. Binomial theorem:

a and b represent the number of each type and n is the number of all types and k is the number that we choose.

13. Cosine Rule:

a,b,c are sides and A is the angle.

14. Nth term of Taylor Series and Taylor Series:

The Taylor series allows us to approximate functions with polynomials, providing a useful tool for calculus, numerical analysis, and various other areas of mathematics and engineering. It enables us to approximate complicated functions with simpler ones, making it easier to analyze and manipulate them.

15. Volume Of a Cylinder (V) :

r is the radius, h is the height of the cylinder, π is a constant with a value of 22/7

16. Volume Of a Cone (V):

r is the radius, h is the height of the cylinder, π is a constant with a value of 22/7

17. Area of a trapezoid (A):

b1 and b2 are the two bases and h is the height

18. Bézout’s identity:

a and b are numbers, LCM is Lowest Common Multiple and HCF is Highest common Factor (GCD)

19. Sieve of Eratosthenes:

To remember the numbers methodologically, check out this.

20. Demorgan’s Law in Sets:

Application of Demorgan’s First Law
De Morgan’s First Law: It states that the complement of the intersection of two sets is equal to the union of their complements.
Application of Demorgan’s Second Law
De Morgan’s Second Law: It states that the complement of the union of two sets is equal to the intersection of their complements.

21. Fourier Series:

a0​, an​, and bn​ are the Fourier coefficients, n is the index of the harmonic, L is the period of the function

22. Bayes’ theorem:

A and B are events and P(x) where P is the probability of x

23. Newton’s method:

for finding the roots of a function

24. Convolution:

for combining two functions into a third function

25. Variance:

n is the number of points in the dataset, xi is the point i in the dataset and μ is the mean of the dataset

Standard Deviation — Square Root Of Variance

26. Geometric Distribution:

Probability Mass Function PMF where k is the number of trials needed to achieve the first success, and p is the probability of success on each trial.
Expected Value (E) Mean and Variance of PMF

27. Rank of a Matrix:

The rank of a matrix is always less than or equal to the minimum of its number of rows and its number of columns.

28. Determinant Of A Matrix

Formula for finding determinant
Example for finding determinant

29. Inverse Of A Matrix:

Formula for Finding Inverse
Example for Finding Inverse

30. Eigen Values and Vectors Of A Matrix:

λ is an eigen value and v is an eigen vector
This formula is helpful in finding the eigen vector

Thank You for the read. Tune in with me, Kaivalya Vanguri, to get more updates on Computer Science.

--

--