The equation I grew up with is this :
Xc = 1 / ( 2 pi f C ) expressed in ohms
If this is the equation you are trying to derive, forget it... this equation is not ( in math terms ) "rigorously correct", it is actually a crude "rule of thumb", which has some built-in assumptions that are NEVER identified, anywhere. You were on the right track but didn't go far enough... The term SIN wt / COS wt can be re-written as TAN wt, which evaluates to a quantity that varies from +infinity to -infinity, twice during each cycle.
The equation you created actually expresses the INSTANTANEOUS RESISTANCE of a capacitor, driven with a sine wave. ( = instantaneous voltage across the capacitor, divided by instantaneous current flowing through the capacitor ) The fact that this value ( I will call it Rc ) varies from +infinity to -infinity... twice during each cycle... is actually 100% correct.
The instantaneous resistance evaluates to a positive Rc quantity during the 1st and 3rd "1/4 cycle" intervals of a sine wave driving waveform, and it evaluates to a negative Rc quantity in the 2nd and 4th "1/4 cycle" intervals of the same driving waveform.
This simply indicates that energy is flowing IN TO the capacitor during the 1st and 3rd ( 1/4 cycle ) intervals, ( i.e the circuit is "charging" the cap = +Rc ) and energy is flowing OUT OF the capacitor during the 2nd and 4th ( 1/4 cycle ) intervals. ( i.e the cap is "discharging" energy back into the circuit = -Rc )
( repeating, this all assumes the driving waveform is a sine wave... and ONLY a sine wave )
The fact that the Rc value is totally "wild" and varies from +infinity to -infinity... twice... during each cycle... means the "resistance" of a capacitor driven with a sine wave DOES NOT HAVE A SPECIFIC VALUE THAT CAN BE IDENTIFIED OR USED IN ANY CIRCUIT CALCULATIONS. Stated differently, the concept of RESISTANCE as an expression of the voltage / current ratio in a capacitor ( driven with a sine wave ) IS USELESS.
That is why the voltage / current ratio of a capacitor is NEVER identified with the word RESISTANCE... instead, a NEW quantity is "invented" which is similar, and much more useful... called REACTANCE, which is also expressed in Ohms.
Reactance is defined as the RATIO of MAXIMUM VOLTAGE to MAXIMUM CURRENT, within each ( applied ) sine wave cycle... For a capacitor, maximum VOLTAGE occurs at w = +1/4 cycle, when SIN(w) = +1, and maximum current occurs at w = +0/4 cycle, when COS(w) = +1. Substituting these constants back into your equation will yield the well-known ( basic algebra ) equation for capacitive reactance...
Xc = 1 / ( 2Pi f C )
So... that equation is NOT TRUE at every instant in time... it expresses the ratio of MAX voltage to MAX current, but it ignores the fact that these two maxima do NOT occur simultaneously.... and there is nothing in the equation to even "hint" that this ( unethical ) "trick" is being done... that explains A LOT...
That's why summing together ( plain algebra ) values of R and X must be done with vector addition, instead of algebraic addition... the vectors take the "timing differences" into account when the sum is done... algebraic sums can't do that.
You will never, ever see an explanation like this anywhere in a text book because no-one wants to take the time to explain all this stuff... because it's basically a big mess that everyone wishes would just go away... and it does go away, if you use higher math... but "mere mortals" must muddle through life with plain old algebra, and it just won't do the job properly, in this case.