I'm trying to determine the gradient of a tangent to a curve defined by a radial function $r = f(\theta)$. It's a programming application and the actual function is gigantic but lets say that $r = θ^2$.

My first attempt was to get the gradient of the tangent to the curve of $y = x^2$ at $x = \theta$, calculate the angle of that line then add it to the original angle $+ 90^{\circ}$ i.e, sum the angle of the tangent of a circle and a tangent to the curve.

But I think this is incorrect, as the gradient of the curve itself in a polar coordinate system is not the same as the gradient of the curve in a Cartesian system, nor is this inequality compensated by summing it with the angle of the circles tangent. It certainly isn't working in practise.

But I'm stumped now, I don't know how to compensate the gradient for the turn in the circle. Can anyone help, or provide some hints on how to solve this problem? I don't know how clear I'm articulating my problem or attempted solution, so I'll happly clarify or add diagrams if necessary

-
The title says "gradient to the tangent of a radial function", the body says "gradient of a tangent to a curve defined by a radial function", and I understand neither of them, nor why you seem to believe that they're equivalent. Please define those terms. – joriki Oct 18 '12 at 11:09
Sorry, question should read gradient of a tangent on a radial function – Tomas Cokis Oct 18 '12 at 11:15
So we have a radial function r = theta-squared which graphs a circle over 0 <= theta < 360. There is a tangent to this curve at a particular known angle, and I want to determine the gradient of that tangent line. – Tomas Cokis Oct 18 '12 at 11:18
a) The title and body still don't agree; "a tangent to a curve" makes sense and "a tangent of a radial function" doesn't (to me). b) I don't know what "the gradient of a tangent" is. Do you mean the slope of the tangent? – joriki Oct 18 '12 at 11:30
a) The tangent is to a curve which is defined by a radial function b) The gradient of a line is the slope of a line, yes. Thats how its taught in Australia, I wasn't aware there was a difference in terminology, sorry. – Tomas Cokis Oct 18 '12 at 11:33

$$\def\d{\mathrm d} \frac{\d y}{\d x}=\frac{\d(r\sin\theta)}{\d(r\cos\theta)}=\frac{\sin\theta\,\d r+r\cos\theta\,\d\theta}{\cos\theta\,\d r-r\sin\theta\,\d\theta}=\frac{\sin\theta\,r'+r\cos\theta}{\cos\theta\,r'-r\sin\theta}\;.$$