Integrating powers of sin x

How do you find

In = ∫ sinn x dx

This is easy and satisfying to do using Integration by parts:

∫ u dv = uv - ∫ v du

Take u=sin n-1x and dv = sin x dx

This means v = -cos x, and du=(n-1) cos x sin n-2x dx

Then In = ∫ u dv = -cos x sinn-1x + (n-1)∫ cos2x sinn-2x dx

Substituting cos2x = 1 - sin2x inside the integral sign, notice that we get an iterative relationship involving In-2

Then In = -cos x sinn-1x + (n-1)(In-2 - In)

nIn = -cos x sinn-1x + (n-1)In-2 -mathformula not MarkupType-
Fatal error: Uncaught Error: Call to undefined method mathformula::makeTypeDef() in /var/www/vhosts/ent.storkey.uk/html/inc/reporting2.php:365 Stack trace: #0 /var/www/vhosts/ent.storkey.uk/html/inc/dynaPage.php(189): echo_value('intsinpower', 'content', Array) #1 /var/www/vhosts/ent.storkey.uk/html/inc/dynaPage.php(742): dynaPage->echo_value('content') #2 /var/www/vhosts/ent.storkey.uk/html/inc/dynaPage.php(179): mainPanel->write('main-panel') #3 /var/www/vhosts/ent.storkey.uk/html/index.php(21): dynaPage->write() #4 {main} thrown in /var/www/vhosts/ent.storkey.uk/html/inc/reporting2.php on line 365