So I was trying to find the indefinite integral $\int sin^2(x)dx$ by reverse engineering it, i.e by finding a suitable polynomial which can be differentiated to find the original integral.
$I = \int sin^2(x)dx \\ D = {d\over dx}sin^3x = {d(sin^3x)\over dsin(x)}* {d(sinx)\over x} * {d(x)\over dx} \text{[Using Chain Rule]}\\ => D = 3sin^2x*cosx*1 => D = 3sin^2x.cosx\\ => {d\over dx}({sin^3x\over 3cosx}) = sin^2x \text{ (... 1)}\\ \int {1\over3cosx}dx = \frac 13 * \int secx dx = {\ln(|tanx+secx|)\over 3} => {1\over 3cosx} = {\ln(|tanx+secx|)\over 3}dx\\ \text{Substituting this value in ...1,}\\ {d\over dx}{sin^3x*\ln(|tanx+secx|)\over 3} = sin^2x \\ => \int {d\over dx}{sin^3x*\ln(|tanx+secx|)\over 3} = \int sin^2x\\ => I = {sin^3x*\ln(|tanx+secx|)\over 3} + C $
On using Calculators online, the answer comes up to be $$ {\frac 12}(x-{sin2x\over2})+C$$ The answers may come back different but the area under the graph should be constant, so I tried to put $x = \pi$ in both equations and omitted the arbitrary constant. On putting these in a scientific calculator, two different values are obtained. According to the online formula, the Area under Graph = ~1.54
Meanwhile, using the formula I obtained, Area under Graph = ~$3*10^-6$
Did I do any step wrong, and if so, what would be the correct formula using this method?
$$ \frac{d}{dx}(\sin^3 (x)) = 3 \sin^2 (x) \cos (x) $$ does not imply $$ \frac{d}{dx} \left( \frac{\sin^3 (x)}{3 \cos(x)} \right) = \sin^2 (x). $$ This is where you went wrong. You can't put the $\cos(x)$ inside the derivative like that. You can only say that $$ \frac{1}{\cos(x)}\frac{d}{dx} \left( \frac{\sin^3 (x)}{3} \right) = \sin^2 (x), $$ as long as $\cos(x) \neq 0 $.