# Finding the x and y components of a vector that is projected tangent to a circle

Here is a diagram I made for the problem.

There is a very similar question on this website, but there wasn't a clear solution for that one when it came to the components of the vector. They seemed to just find the magnitude of that vector as seen here: Finding the component of a vector tangent to a circle

The problem is how do I find the actual x and y components of this tangent vector because all of the solutions I've seen don't find signed components which I need for the simulation I am programming. I took vector calculus and linear algebra about 3 years ago, so I just can't seem to figure out this problem.

• I'm confused about the purpose of the green circle's velocity arrow, since in a circular motion the velocity of the object should always be tangent to the circle. Mar 29 '17 at 5:54
• Construct a right triangle, with radius as hypotenuse. Find trignometric ratios and using them you can get the answer. Mar 29 '17 at 6:13
• What right triangle do you have in mind, exactly?
– amd
Mar 29 '17 at 9:36
• @YiyuanLee Its for a game where the green circle is moving around the screen freely in any direction then when a key is pressed the green circle swings around the other circle as seen in this gfycat gfycat.com/DamagedEmbellishedDoctorfish Mar 30 '17 at 15:54

1) Construct a unit vector $\vec n$ perpendicular to $BG$ ($B$ and $G$ are the centers of blue and green circles):

$$\vec n={(-y_G+y_B,x_G-x_B)\over\sqrt{(x_G-x_B)^2+(y_B-y_G)^2}}.$$

2) If $\vec v$ is the velocity vector (green) then the vector you want (orange) is:

$$(\vec n\cdot\vec v)\vec v.$$

• Thanks for the answer, but isn't $$(\vec n\cdot\vec v)\vec v.$$ a magnitude? I need the x and y components of the orange vector Mar 29 '17 at 8:02
• @BradMatias No. The left factor is a scalar, the right one a vector.
– amd
Mar 29 '17 at 9:34

It looks like you’re looking for the projection of the green vector onto the tangent to the large circle. This is the same as finding the orthogonal rejection from the normal to the circle at that point, which is the difference between the vector and its projection onto the normal.

Let $\vec n=\langle x_g-x_b,y_g-y_b\rangle$ and $\vec v$ be the velocity vector. $\vec n$ is parallel to the radius of the large circle at the green circle’s location, so is clearly normal to it there. The tangential velocity is then $$\vec v_{\text{tan}}=\vec v-{\vec v\cdot\vec n\over\vec n\cdot\vec n}\vec n.$$ Taking the values in the illustration, this gives $$\vec n=\langle128,196\rangle-\langle64,64\rangle=\langle64,132\rangle \\ \vec v=\langle10,3\rangle \\ \vec v_{\text{tan}} = \langle10,3\rangle-{\langle10,3\rangle\cdot\langle64,132\rangle\over\langle64,132\rangle\cdot\langle64,132\rangle}\langle64,132\rangle=\langle10,3\rangle-{1036\over21520}\langle64,132\rangle\approx\langle6.92,-3.35\rangle.$$

• this solution works for counter clockwise tangents, but when this process is applied to a starting velocity where it would result in a clockwise spin it still returns a vector pointing in the clockwise direction. Here's a gfycat of it happening gfycat.com/BrokenDearestGrayling Mar 31 '17 at 6:12
• @BradMatias If you’ll look again at the example that I worked with your own data, you’ll see that it is a clockwise tangent. Using the same two points and $\vec v=\langle 0,10\rangle$ instead, I get a tangential velocity of approx. $\langle-3.93,1.90\rangle$, which is a counterclockwise tangent. If it’s not working for you, then you’ve probably got a sign error or some other arithmetic error in your computation.
– amd
Mar 31 '17 at 6:32
• oh I literally have no idea how my edit didn't go through, your solution is right I edited my comment, but I guess it didn't send. The issue I had was when I was calculating angular velocity from the output of your solution I wasn't getting a signed answer. Apr 1 '17 at 9:38