In simple harmonic motion, you can use either the sin or cos form of the equation but my question is which one do you use when and why?
I am having a tough time understanding this, so any help would be thoroughly appreciated
$y(t)=A \sin(\omega t+d)=A \cos(\omega t+d-\left(\frac\pi2\right))$
The two forms are the same except for the phase term, so which one you use depends on when you started your stopwatch.
If you started off at max displacement at t=0, then you use the cosine form, if you start out with max velocity at t=0, then you use the sine form.
If you are deducing the wave equation from measurements, use either form and let the phase term tell you how close you are. It doesn't really matter which one you pick.
which one do you use when and why?
It is possible to use both: $$x(t)=A\cos(\omega t)+B\sin(\omega t)$$ or either, as Simon Bridge suggests in his answer, or neither (explicitly) by using complex exponential forms: $$z(t) = Ce^{i\omega t}+De^{-i\omega t}$$
Which one to use is up to you. They all are correct and all will work. One of them is usually more efficient in reaching a clean solution. Which to use so that the solution is easily determined is a matter of good judgement that comes from practice in solving many different initial conditions. There is no hard and fast rule or rubric that will guarantee the most efficient algebraic process.
It is a matter of choosing in which configuration you start noting the time. For example, the general equations are- $y=Asin\omega t$ and $x=Acos\omega t$.
Now, suppose in the situation you are analysing, the body is at its maximum amplitude when released ( for example, a pendulum is taken to a certain height and released); in this case, we start analysing when at $t=0$, $y=A$ (i.e. Maximum amplitude). Then, we obviously use the cosine equation, as only this gives $y=A$ on substituting $t=0$.
The opposite condition is that the body is given a slight displacement from its mean position(i.e.displacement=0), we start our analysis so that at $t=0$,$x=0$; the equation to be chosen here is the sine equation, which gives $y=0$ at $t=0$. An example of this situation is when a pendulum hanging is given a slight nudge to move it. Here, initially(t=0), the pendulum is in mean position(y=0); hence the sine equation.
In a nutshell;
1) if the oscillations are noted starting from the maximum amplitude in initial position, use cosine equation.
2) if the oscillations are being noted from mean position i.e. minimum displacement in initial position, use sine equation.
A simple harmonic motion is a special type of oscillation in which the particle oscillates around a fixed point in a straight line. That fixed point is called the centre of oscillation.
By definition the force is always towards the centre and is directly proportional to the displacement from the centre of the particle undergoing SHM. For mathematical analysis let the centre of oscillation be at rest in our frame of reference and the line of motion be the x-axis. Mathematically, $$F=-kx$$ $$ma=-kx$$ $$a=-\left( \dfrac{k}{m} \right)x$$
Let us define a quantity $\omega= \sqrt {\dfrac{k}{m}}$. It is to be noted here that $\omega$ is a positive quantity. In terms of $\omega$ the equation of S.H.M becomes $a=-\omega ^2x$. Now you can express S.H.M as a differential equation of second order as: $$\dfrac{\mathrm{d}^2 x}{\mathrm{d}t^2} = -\left(\dfrac{k}{m}\right)x$$
The solution of this equation can be found easily but I found a tricky solution in the book "concepts of physics" by H.C Verma; it gives more insight to the problem.
$$a=-\omega ^2x$$
$$\dfrac{dv}{dt}=-\omega ^2x$$
Now $v$ and $x$ these two depend upon $t$ i.e. $t$ is the independent variable. But the trick is that $v$ also depends upon $x$ which in turn depends upon $t$ so $v$ can be conceived as a function of $x$. In other words $$x=F(t), v=G(t) \implies t=F^{-1}(x) \implies v=G(F^{-1}(x)) $$. So we can say now $v$ is a function of $x$ and $x$ is a function of $t$. We can apply the chain rule now $$\dfrac{dv}{dt}=\dfrac{dv}{dx} \dfrac{dx}{dt}$$
Using equation of SHM we get :
$$ \dfrac{dv}{dx} \dfrac{dx}{dt}=-\omega ^2x $$
$$ \implies v\dfrac{dv}{dx}=- \omega ^2 x$$
This can be written in differential form as $$vdv=-\omega ^2xdx. \tag{1}$$ Let at $t=0$ displacement $x=x_0$ and velocity $v=v_0$ . Integrating equation (1) on both the sides,
$$\int_{v_0}^v vdv= -{\omega}^2\int_{x_0}^x xdx$$
$$ \left[ \dfrac{v^2}{2} \right]_{v_0}^{v} = -\omega ^2 \left[ \dfrac{x^2}{2} \right]_{x_0}^x$$
$$v^2-v_0^2= -{\omega}^2 (x^2-x_0^2)$$
$$v^2 = {\omega}^2 \left( \dfrac{{v_0}^2}{{\omega}^2} - (x^2-x_0^2) \right)$$
$$\implies v= \omega \sqrt{ \left( \dfrac{v_0}{{\omega ^2}} - x^2 + {x_0}^2 \right) }$$
Let $\left[\dfrac{{v_0}^2}{\omega ^2} + x_0^2\right]= A^2$ this implies $v=\omega \sqrt{A^2-x^2}$ Again since $v=dx/dt$ we have: $$\dfrac{dx}{dt}=\omega \sqrt{A^2-x^2}$$ This can be converted to the standard form which is integratable, so $$\dfrac{dx}{\sqrt{A^2-x^2}}=\omega dt$$ Integrating within proper limits $$ \int_{x_0}^x\dfrac{dx}{\sqrt{A^2-x^2}}=\int_0^t \omega dt$$ So $$\left[\sin^{-1}\dfrac{x}{A}\right]_{x_0}^x=\left[\omega t\right]_0^t$$ or, $$\sin^{-1}\dfrac{x}{A}-sin^{-1}\dfrac{x_0}{A}=\omega t$$
Let $\sin^{-1}\dfrac{x_0}{A}= \delta$, that is $$\sin^{-1}\dfrac{x}{A}=\omega t+\delta$$ Which can be written as $$x=A \sin (\omega t+\delta)$$
Velocity comes out to be $$v=\dfrac{dv}{dt}=A\omega \cos(\omega t+\delta)$$
The last two equations are very general. If you choose $t=0$ when the displacement $x$ is $0$ then $\delta$ becomes $0$ so the expressions will reduce to $$x=A \sin(\omega t) \text{and} v=A \omega \cos(\omega t)$$. But if you choose $t=0$ when displacement is maximum(at which $v=0$) $\sin(\delta)$ becomes $1$ hence $\delta$ becomes $\pi/2$ so our expressions reduces to $$x=A \cos(\omega t) \text{and} v=A\omega \sin(\omega t)$$.
You may argue why $\omega$ was defined to be positive as we could have set $\omega = \pm \sqrt{\dfrac {k}{m}}$. The reason behind this is to find a solution which can be represented as a phasor. A phasor always revolves anticlockwise this can only be true if $\omega$ is positive.