# Differentiate: r=r cos(theta)i+r sin(theta)j

1. Feb 5, 2017

### jrjack

1. The problem statement, all variables and given/known data
This is a problem from Dynamics but I'm mostly having trouble with the calculus.

Derive an expression for the position, velocity, and acceleration of a machine in terms of: $r, \dot {r}, θ, \dot{θ}, \ddot{r}, \ddot{θ},$.

r = length of the arm
θ = angle of the arm to the positive x-axis
$\dot {r}$ = derivative of r with respect to time
$\dot {θ}$ = derivative of θ with respect to time
$\ddot {r}$= second derivative of r with respect to time
$\ddot {θ}$ = second derivative of θ with respect to time

https://goo.gl/photos/ZF8Kzn1MEwN69Ev19

2. Relevant equations
$$x=r\cos(\theta); y=r\sin(\theta)$$
$$\vec{r} = r\cos (\theta) \hat{i} + r\sin (\theta) \hat{j}$$

I am having trouble combining the product rule and chain rule with multiple variables...
And from there I get lost trying to find the second derivative...
(I last took Calculus 2 about 5 years ago, and have had very little practice since)

3. The attempt at a solution
$$\dot{r} = \vec{v} = - \dot{r} \sin (\theta) \dot{\theta} \hat{i} + \dot{r} \cos (\theta) \dot{\theta} \hat{j}$$

Did I apply the chain rule correctly?

or

$$\dot{r} = \vec{v} = (-r \sin (\theta) \dot{\theta} + \dot{r} \cos (\theta) \dot{\theta}) \hat{i} + (r \cos (\theta) \dot{\theta} - \dot{r} \sin (\theta) \dot{\theta}) \hat{j}$$

Did I combine the chain and product rules correctly?

#### Attached Files:

• ###### Figure 2.JPG
File size:
27.1 KB
Views:
17
Last edited: Feb 5, 2017
2. Feb 5, 2017

### Staff: Mentor

The link to the image is broken here.
Neither attempt is correct. One thing that might be helpful is to recognize that $\vec{r}$ and r are different things.

In your equations $x=r\cos(\theta)$ and $y=r\sin(\theta)$, r is a scalar, where $|\vec{r}| = r$. IOW, r the scalar is the magnitude or length of $\vec{r}$ the vector. Now in these equations is r a function t or is it just a number?

Let's look at each component of $\vec{r}$, starting with $r\cos(\theta)$. What do you get for the derivative wrt t of this expression? Hint: $\dot{r}$ and $\dot{\theta}$ should not appear in the same term.

Please use parentheses: stuff like $\cos \theta \dot{\theta}$ is hard to read.

3. Feb 5, 2017

### jrjack

I get that $r$ is the magnitude of $\vec{r}$
Both $r$ and $\theta$ are functions of time.

$$x = r \cos (\theta)$$
Applying the product rule to $r$ and $\cos(\theta)$ yields:
$$\dot{x} = r (-\sin)(\theta) + \dot{r} \cos (\theta)$$
And adding the chain rule to $\cos (\theta)$ gives:
$$\dot{x} = r (-\sin)(\theta) \dot{\theta} + \dot{r} \cos (\theta) \dot{\theta}$$

Is that part correct?

4. Feb 5, 2017

### Staff: Mentor

No. As I said before, you shouldn't have both $\dot r$ and $\dot{\theta}$ in the same term.
Let's get rid of the dot notation, as that might be causing confusion. Also, don't write things like $r (-\sin)(\theta)$. It should be written as $r(-\sin(\theta))$ or $-r\sin(\theta)$.

$x = r \cos(\theta)$
$\frac{dx}{dt} = \frac d {dt}\left(r\cos(\theta)) \right) = \frac {dr}{dt} \cos(\theta) + r \cdot \frac d {dt}\left(\cos(\theta) \right)$
Here I have used the product rule, and am getting ready to use the chain rule on the cosine factor on the right. Can you finish this off?

When you do, apply the same thinking to $y = r\sin(\theta)$

5. Feb 5, 2017

### jrjack

Ok, so I don't need to chain rule the 1st cosine factor, and adding the chain rule on the cosine factor on the left: $\cos(\theta) \cdot \frac{d\theta}{dt}$

gives:
$$\frac{dx}{dt} = \frac d {dt}\left(r\cos(\theta)) \right) = \frac {dr}{dt} \cos(\theta) + r \cdot \left(\cos(\theta) \cdot \frac{d\theta}{dt} \right)$$
and...
$$y=r \sin(\theta)$$
$$\frac{dy}{dt} = \frac d {dt}\left(r\sin(\theta)) \right) = \frac {dr}{dt} \sin(\theta) + r \cdot \left( \cos(\theta) \cdot \frac{d\theta}{dt} \right)$$

6. Feb 5, 2017

### Staff: Mentor

Almost.
In parentheses at the right, above, it should be $-\sin(\theta) \cdot \frac {d\theta}{dt}$

I suspect you were more focussed on the LaTeX than on the math.

The one below looks fine.

7. Feb 5, 2017

### jrjack

Ah yes, it's been 5 years since I typed anything in LaTeX either, but I wrote it correctly on my paper. Now I need a refresher on getting the second derivative of the equation.
I have:
$$\vec{r} = r \cos(\theta) \hat{i} + r \sin(\theta) \hat{j}$$
$$\vec{v} = \left( -r \dot{\theta} \sin(\theta) + \dot{r} \cos(\theta) \right)\hat{i} + \left(r \dot{\theta} \cos(\theta) + \dot{r} \sin(\theta) \right) \hat{j}$$
Differentiating term by term and taking the first part: $-r \dot{\theta} \sin(\theta)$
or $-r \frac{d\theta}{dt} \sin(\theta)$
I am not exactly sure how to apply the product rule to 3 terms???
Do I take 1st times d/dt of the second, times d/dt of the third ? plus d/dt of the 1st times the second and third variables?
$$\frac{d^2\vec{r}}{dt^2} = -\left(r \frac{d^2\theta}{dt^2} \cos(\theta) \frac{d\theta}{dt} + \frac{dr}{dt} \sin(\theta) \frac{d\theta}{dt} \right)$$

8. Feb 5, 2017

### jrjack

A few Multiple function product rule refresher videos later...
I believe the 1st term should go from:
$$-r \frac{d\theta}{dt} \sin(\theta)$$
to:
$$- \left( \frac{dr}{dt} \frac{d\theta}{dt} \sin(\theta) + r \frac{d}{dt}(\frac{d\theta}{dt} \sin (\theta)) \right)$$
$$- \left( \frac{dr}{dt} \frac{d\theta}{dt} \sin(\theta) + r ((\frac{d\theta}{dt})^2 \cos(\theta) + \frac{d^2\theta}{dt^2} \sin(\theta) \right)$$

3 terms left to go...if my thought process is correct on this 1st term.