### Theory:

Let us assume Rohit deposited a sum of $$₹$$40000 in a bank for $$2$$ years at an interest of 7$$\%$$ compounded annually. Then we will find out the Compound Interest $$(C.I)$$ and the amount she has to pay at the end of $$2$$ years in a couple of steps.
To determine the compound interest for $$2$$ years, first find out the simple interest for one year using principal and rate. Then find the amount for one year.

Then this amount will be the principal for next year.

Then again calculate the simple interest and amount. Then if you add the interest of both years we can find out the compound interest.
Step 1)

First we have to calculate the interest year by year. And we already studied to calculate the simple interest, that is:

${I}_{1}\phantom{\rule{0.147em}{0ex}}=\phantom{\rule{0.147em}{0ex}}\frac{{P}_{1}×n×r}{100}$

Here the principal $$P1$$ $$= ₹$$40000

The time period  $$n$$ $$=$$$$1$$ years.

The rate of interest $$r$$ $$=$$7$$\%$$

Substitute the known values in the formula we will get:

${I}_{2}$ $$=$$ $\frac{40000×1×7}{100}$ $$=$$ 2800

Step 2)

Then find the amount which will be received end of the year. This becomes principal for the next year.

Amount at the end of $$1$$st year $$=$$ Principal of first year $$+$$ Interest of first year

$$=$$ $2800+40000$

$$= ₹$$42800.

Amount at the end of $$1$$st year $$= ₹$$ 42800 $$=$$ $$P2$$ [Which is principal for $$2$$nd year]

Step 3)

Again find the interest on this sum for another year $$=$$ ${I}_{2}\phantom{\rule{0.147em}{0ex}}=\phantom{\rule{0.147em}{0ex}}\frac{{P}_{2}×n×r}{100}$

Simple interest at  7 $$\%$$ for second year $$=$$ $\frac{42800×1×7}{100}$ $$= ₹$$2996.

Step 4)

Find the amount which has to be paid or received at the end of second year.

Amount at the end of $$2$$nd year $$=$$ Principal ${P}_{1}$ $$+$$ Interest of second year

$$=$$ $42800+2996$

$$=$$ 45796.

Now we know the interest for both years therefore the total interest received is:

$$=$$ Interest of first year $$+$$ Interest of second year

$$=$$ $2800+2996$

$$= ₹$$ 5796.

So this $$= ₹$$ 5796 is called as compound interest.

We can also find this compound interest in other way too that is:

Compound interest $$C.I =$$ Final amount ${A}_{2}$ $$–$$ Initial principal ${P}_{1}$.

$\begin{array}{l}C.I\phantom{\rule{0.147em}{0ex}}=\phantom{\rule{0.147em}{0ex}}45796-40000\\ \\ C.I\phantom{\rule{0.147em}{0ex}}=5796\end{array}$
And do you think is there will be any difference in rupees between the simple and compound interest? Let's find out that too.
Simple interest for $$2$$ years with rate of  7 $$\%$$ and principal is  $$= ₹$$ 40000.

$$I =$$${I}_{1}\phantom{\rule{0.147em}{0ex}}=\phantom{\rule{0.147em}{0ex}}\frac{{P}_{1}×n×r}{100}$

$$=$$ $\frac{40000×2×7}{100}$

$$= ₹$$5600.

Now we can find the difference between the simple interest and compound interst that:

$$S.I$$ after $$2$$ years with rate of 7$$\%$$ $$= ₹$$5600.

$$C.I$$ after $$2$$ years with rate of 7$$\%$$ $$= ₹$$5796.

It is evidently shows that compound interest is much higher than the simple interest.