In a circuit with just a resistor and a capacitor I'm trying to figure out which voltage is being referred to that is lagging the current(which is the same current throughout the entire SERIES AC circuit). The voltage which leads or lags is the same voltage referred to by $$I(t)=C\frac{dV(t)}{dt}$$ which comes from the derivative of $$V(t) = \frac{Q(t)}{C} = \frac{1}{C}\int_{t_0}^t I(\tau) \mathrm{d}\tau + V(t_0)$$ Therefore the voltage which lags is the voltage drop across the capacitor because the charges are added above to the plates of the capacitor so the voltage refers to it. In an AC circuit, the voltage source is forced to alternate with a cosine wave and the phase difference between the source current driven by $$V_0\cos(\omega t)\tag{1}$$ and the voltage which I'm asking about comes from: $$I = C \frac{dV}{dt} = -\omega {C}{V_\text{0}}\sin(\omega t)\tag{2}$$ which is the same as $$I = {I_\text{0}}{\cos({\omega t} + {90^\circ})}$$
The voltage used in this formula was the source voltage not the voltage drop across the capacitor which defines Capacitance. The voltage across the capacitor is not instantaneous and in fact exponentially decays up to the applied voltage as shown by a constant DC voltage circuit where : $$V_0 = v_\text{resistor}(t) + v_\text{capacitor}(t) = i(t)R + \frac{1}{C}\int_{t_0}^t i(\tau) \mathrm{d}\tau$$ Taking the derivative: $$RC\frac{\mathrm{d}i(t)}{\mathrm{d}t} + i(t) = 0$$ Solving the first order: $$I(t) = \frac{V_0}{R} \cdot e^{\frac{-t}{\tau_0}}$$ Assuming initially the resitor is $V_0$ the voltage of capacitor: $$V(t) = V_0 \left( 1 - e^{\frac{-t}{\tau_0}}\right)$$
Thus I'm confused about where the $90^\circ$ voltage lag comes from. If it's because of the derivative of the source voltage why is formula 2 even applicable to the source voltage. Second question: What is the formula for the voltage reached by the capacitor in an ac circuit. It appears as if it is the source max voltage but I don't believe/understand that. Here is an identically solved using a sin source Voltage:
$$I_C+I_{max}\sin(\omega t +90^\circ)$$
In the above derivation, the source voltage is again mixed with the formula for the voltage stored across a capacitor or I'm to believe the maximum source voltage is somehow reached on the exponential decay to the voltage on a capacitor during a cycle.
Could someone either explain why the source voltage is used as if it was the capacitor voltage or the identically reversed inductor or refer me to a source that explains it?
Sources:
(1)https://en.wikipedia.org/wiki/Capacitor
(2)http://www.electronics-tutorials.ws/accircuits/ac-capacitance.html