Calculate equation of normal line on any given point I know there are alot of topics about this, but almost all of them cover the case when you are  given an explicit point like (3,6), but I need the general formula to solve for any given X and I'm a bit lost at the process of calculating it.
Here is what I did so far:
given f(x) = sin( x)
I would like to find the tangent ( and later the normal) for the point P=(x,sin(x))
I know that the normal line is perpendicular to the tangent line of that function, so first I calculate the slope of the tangent line of f(x), like so:
f'(x) = cos(x)
now that I have the slope of the tangent,I could try to find the equation for the tangent line using this:
y= m*x + b , and replacing...
y = cos(x) * x + b
and to get b :
sin(x) = cos(x) * x + b
then:
sin(x) - cos(x) * x = b
So the equation for the tangent line would be this:
y = cos(x) * x + sin(x) - cos(x) * x
As I said earlier ( according to my understanding) the normal line is perpendicular to the slope of the tangent line, so given two slopes:
m1= slope of tangent
m2= slope of normal
m1*m2 = -1 // To be perpendicular
finding m2:
m2 = -1/ cos(x)
SO, if all of the above is correct, the equation for the normal line would be:
y = (-1/cos(x)) * x + sin(x) - cos(x) * x
Did I do it right? And if so, how do I continue?
Thanks
PS: English is not my native language so my apologies if something isn't clear, just say it in the comments and I will try to explain it better
 A: You're very close. You're using the symbol $x$ both for the first coordinate of the point at which you want to find the normal line andas the variable in the equation of the normal line. Let me rewrite:
Given $f(x) = \sin(x)$, compute the normal line at $(a, \sin(a))$. The slope of the tangent is $\cos(a)$, so the slope of the normal is $\frac{-1}{\cos a}, so the equation of the normal  is
$$
y = \frac{-1}{\cos a} (x - a) + Q
$$
where $Q$ is as yet unknown. But the point $x = a, y = \sin a$ must lie on this line, so we must have
$$
\sin a = \frac{-1}{\cos a} (a - a) + Q
$$
so $Q = \sin a$. Hence your equation is
$$
y = \frac{-1}{\cos (a)} (x - a) + \sin(a).
$$
A: Your equation of the line will involve $y$ and $x$ as variables, presumably in roughly the form
$$y-y_0=m(x-x_0)$$
where $m$ is the gradient at that point. Let's call $x_0=a$ for brevity, and since the line will go through the curve$y=f(x)$, we have $y_0=f(a)$.
The last thing is $m$. We know the gradient of $f(x)$ is just $f'(x)$, and the gradient of the tangent at $a$ will be $f'(a)$ which is $\cos a$ in your example. The gradient of the normal will then be $m=\frac{-1}{f'(a)}$.
Putting this all together we get, at the point $(a,f(a))$ the equation of the normal is:
$$y-f(a)={-1\over f'(a)}(x-a)$$
or $$y=f(a)-{x-a \over f'(a)}$$
For your example, $f(x)=\sin x\implies f(a)=\sin a, f'(a)=\cos a$ and we get
$$y=\sin a-{x-a \over \cos a}$$
A: Suppose we want the equation of the tangent line at a point $x_0$.  Then we know
$$\frac{y-\sin x_0 }{x-x_0}=\cos x_0$$
whereupon solving foyr $y$ gives
$$y=\sin x_0+\cos x_0(x-x_0)$$
or alternatively 
$$y=(\cos x_0)\,x+(\sin x_0-x_0\cos x_0) $$

If we want the line normal to the sine function at $x_0$ then we write
$$\frac{y-\sin x_0 }{x-x_0}=-\sec x_0$$
whereupon solving foyr $y$ gives
$$y=\sin x_0-\sec x_0(x-x_0)$$
or alternatively 
$$y=(-\sec x_0)\,x+(\sin x_0+x_0\sec x_0) $$
