Why is the voltage of a capacitor equal to the voltage of a battery connected it?

I am confused by this question. If we connect a resistor in series to capacitor then the voltage will drop across the resistor and now voltage across the capacitor is less than the source, then why would capacitor charge till it has volts equal to the source?

and why in the below image when the capacitor is fully charged, its voltage is not same as source? • Welcome to EE.SE. This sounds like a homework question. Please show what you have done so far. – winny May 31 '18 at 13:58
• Thanks, actually its a solved question that teacher explained but I did not get it. I have solved some simple RC circuits with the resistor in series but the confusion is there that I described in my question. – Ehtisham Hassan May 31 '18 at 14:04
• If capacitor is fully charged then it should have V equal to source but how it does not have V as source. Why? – Ehtisham Hassan May 31 '18 at 14:05
• look up how a voltage divider works – ratchet freak May 31 '18 at 14:23

If we disconnect the capacitor from the circuit we get this circuit: simulate this circuit – Schematic created using CircuitLab

Let us close our circuit (12V battery and two resistors) in the black-box. We only have a access to A and B terminals. And now let us try to find out what is inside the box, without opening the black-box.

What can we do? Well, we can measure the voltage across AB terminals.

And this voltage happens to be equal to Vth = 16V (24V * R2/(R1+R2))

We also can connect external load resistor and measure the corresponding voltage and current. But we are brave enough and we shot-out A and B terminals. And measure the short-circuit current Isc = 6A (24V/R1)

Based on only those two measurements we can draw the following conclusion. Our black-box is seen by the outside world as an ideal 16V voltage source with internal resistance equal to

Rth = Vth/Isc = 16V/6A = 2.667Ω (Rth = R1||R2)

So, we can remove our black-box from the circuit. And we replace the black-box with his equivalent circuit. The 16V ideal voltage source with 2.667Ω internal resistance. simulate this circuit

And I hope that now you can see that our capacitor will see this equivalent circuit. And this is why capacitor stops charging when the voltage across the capacitor reaches 16V.

Later on, you will be introduced to the Thevenin's theorem. It will help you understand this stuff better.

With just the capacitor, one resistor and a battery, then the capacitor will charge until the current stops flowing. Since V = IR, once the current is zero, the voltage across the resistor is zero. If there's no voltage across the resistor, then all the voltage must be across the capacitor. So the battery and capacitor voltages must be the same.

When you add the second resistor, there's always a current flowing through R1 and then through R2, even when the capacitor is charged. The current through R1 is not zero, so the voltage across it is not zero. Since R1 and C1 are in series, the capacitor can only be getting the voltage that R1 isn't. So it's less than the battery voltage. It will instead be the voltage across R2.