Independent Variables of a Lagrangian Let us consider a particle in one spatial dimension $x$ and one temporal dimension $t$. Its Lagrangian $L$ is given by 
\begin{eqnarray*}
L &=& T- V \\
  &=& \frac{1}{2} m\dot{x}^2 - V(x) \\
  &=& L(x, \dot{x})
\end{eqnarray*}
But if I write $ L = \frac{1}{2} m [\frac{d}{dt}({x})]^2 - V(x)$, then it seems to me that $L$ depends only on $x$. 
So, my question is why it is said that $L$ is a function of $x$ and its derivative $\dot{x}$ ?
 A: The Lagrangian formalism treats $x$ and $\dot{x}$ as independent variables. In particular, you cannot write $\frac{\mathrm{d}}{\mathrm{d}t}x$ because $x$ is not dependent on time.
What is dependent on time is a particular trajectory $x(t)$ that is the solution to the equations of motion (the Euler-Lagrange equations). Prior to solving the equations of motion, $x$ and $\dot{x}$ are independent variables (formally, coordinates of points in the tangent bundle of the configuration space which has the $x$ as coordinates), where you can choose any point $(x_0,\dot{x}_0)$ as an initial condition for the equations of motion since those are typically second order.
After solving the equations of motion, you can obviously obtain any value of $\dot{x}(t_1)$ on the trajectory from the corresponding $x(t_1)$ since the trajectory is a line - it has only the coordinate $t$, and points on it are fully specified by giving the time, and since you fed $(x,\dot{x})$ as the initial conditions $x(0) = x_0,\left(\frac{\mathrm{d}}{\mathrm{d}t}x\right)(0) = \dot{x}_0$ into the Euler-Lagrange equations, the trajectory indeed has the relation $\dot{x}(t) = \left(\frac{\mathrm{d}}{\mathrm{d}t}x\right)(t)$.
A: The thing is that when you write the Lagrangian, you don't know the particle's trajectory yet.   If you had a specified function $x(t)$, then of course $\dot{x}$ is not independent. But if you only know the particle's position at a given time, its velocity can be anything, because you are free to set position and velocity as initial conditions how you please.
In other words, you should be able to calculate the Lagrangian knowing only the particle's kinetic and potential energies. If I only tell you what the particle's position is right now, do you know its kinetic energy? No! You need the velocity for that, and at any given time position and velocity are independent.
