@PrateekMourya it's easy to learn the basics and for most purposes that's all you need. MathJax is an absolutely enormous language with thousands of symbols, but you only need about a dozen of them for most equations.
Because the pendulum is displaced a distance $r$ from the origin the restoring force is $F = -kr$, and that force points along the line $r$ i.e. from the bob to th origin. OK so far?
Now we have displaced the bob a distance $r$ from the origin, so we have a force $F = -kr$ pointing towards the origin i.e. along the vector $\mathbf r$. OK so far?
A small ball is suspended from a point O by a light thread of length l. Then the ball is drawn aside so that the thread deviates through an angle θ from the vertical and set in motion in a horizontal direction at right angles to the vertical plane in which the thread is located. The initial velocity that has to be imparted to the ball so that it could deviate through the maximum angle 2 π in the process of motion is v 0 = cosθ xgl
We don't care what forces are acting in the z direction, because the bob is held by the string so it cannot move up or down. It can only move in the x and y directions.