A question about canonical momentum and arbitrariness for potential in magnetism The following question confuses me:

There exists magnetic field $B_z =- \beta x$ where $x > 0$, and a particle is incident from origin point $(0,0)$ with pisitive charge $q$, mass $m$, and speed $v$ along the $x$ axis. It is very convenient to restrict our discuss in two dimension plane, the $x$-$y$ plane. Find the particle coordinate when its speed is along $y$ axis.


I want to apply the canonical momentum to find the point.
The canonical momentum, $P=p+qA$, is a conservation quantity when the particle moves. I let the potential $A=(0,- \frac{1}{2} \beta x^2)$ satisfied $B=\nabla \times A$ and the Coulomb's gauge $\nabla \cdot A = 0$, hence the original canonical momentum is $(mv,0)$, and the canonical momentum is always equal to $(mv,0)$.
When the particle is along the y axis, the momentum of the particle is $(0,mv)$, so the potential must be satisfied $qA=P-p=(mv,-mv)$.
Here, I am in trouble. I cannot solve the point where the potential $A$ equals to $(mv,-mv)$, unless I choose another expression for potential.
I am confused about the expression of potential. It should be arbitrary for physics, but here, it is not. If I choose $A=(a \beta xy,b \beta x^2)$ and $2b-a=-1$, there is a freedom degree to set the value of $a$ or $b$, and the point that I have to find is not fixed.
I want to know why here the potential cannot be arbitrarily set its value. Could someone help me?
 A: The canonical momentum is not conserved.
See Landau&Lifshits, vol 2 chap 3.
Let us examine case of homogeneous magnetic field. Then A=xB. We can add constant vector A0 (parallel X axes) without magnetic strength changing. Resulting potential A1=A+A0. Thus canonical momentum equals (mv+qA1,0) at initial position. After quote of circulation the partical velosity is parallel Y axes and canonical momentum equals (qA1,mv)
A: You know that $$m\vec a=q\vec v \times \vec B,$$
So in particular, since $\vec B = B\hat z,$ we have $$ma_x=qv_yB,\text{ and } ma_y=-qv_xB. $$
And in our case $B=-\beta x$ so we have $$m\ddot x=-q\dot y\beta x\text{ and } m\ddot y=q\dot x\beta x. $$
You can take the time derivative of the left equation and get $$m\dddot x=-q\ddot y\beta x-q\dot y\beta \dot x,$$ which becomes
$$m\dddot x=-q\left(\frac{q\dot x\beta x}{m}\right)\beta x-q\left(\frac{m\ddot x}{-q\beta x}\right)\beta \dot x.$$ 
This third order equation needs initial conditions $x(0)=0,$ $\dot x(0)=v,$ and $\ddot x(0)=0$ (why?). And you can then find the time $t=T$ when $\dot x(t=T)=0.$ From that $T$ and the function $x(t)$ you can get $x(T)$ which is half of what you want.
You can make a similar third order equation for $y(t)$ and either solve it and then get $t=T$ where $\dot y(t=T)=\pm v$ (which one?) and confirm the two $T$ are the same ($\dot x^2+\dot y^2$, unlike the canonical momentum, is conserved). And in the end from the $T$ and the function $y(t)$ you can get $y(T)$ which is  the other half of what you want.
Note I didn't use a vector potential, a Lagrangian, a Hamiltonian, or an appeal to QM. And the one use of a conserved quantity, $\dot x^2+\dot y^2,$ was optional.
So what's wrong with what you did? Firstly, canonical momentum is usually not a conserved quantity, it is just the variable needed to make a Legendre transformation from the $Q, \dot Q$ coordinates of the Lagrangian to the $Q,P$ coordinates of the Hamiltonian. If the Lagrangian doesn't depend on a $Q$ then the corresponding $P$ is conserved.  Now, $L(\vec x, \vec v)=-mc^2\sqrt{1-\frac{v^2}{c^2}}+q\vec A\cdot\vec v -q\Phi,$ since 
$$\frac {d}{dt}\left(\frac{mv_i}{\sqrt{1-\frac{v^2}{c^2}}}+qA_i\right)=\frac {d}{dt}\left(\frac{\partial L}{\partial v_i}\right)=\frac {d P_i}{dt}$$
and
$$\frac{\partial L}{\partial Q_i}=v_x\frac{\partial A_x}{\partial Q_i}+v_y\frac{\partial A_y}{\partial Q_i}+v_z\frac{\partial A_z}{\partial Q_i}.$$
The right hand side is not zero, so the Euler-Lagrange equations $\frac {d}{dt}\left(\frac{\partial L}{\partial v_i}\right)=\frac{\partial L}{\partial Q_i}$ do not yield that the momentum $P_i=\frac{\partial L}{\partial v_i}$ is conserved and in fact 
$$\frac {d P_i}{dt}=\frac{\partial L}{\partial Q_i}=v_x\frac{\partial A_x}{\partial Q_i}+v_y\frac{\partial A_y}{\partial Q_i}+v_z\frac{\partial A_z}{\partial Q_i}.$$
The reason we know that the Lagrangian is $L(\vec x, \vec v)=-mc^2\sqrt{1-\frac{v^2}{c^2}}+q\vec A\cdot\vec v -q\Phi,$ is because the Euler-Lagrange equations $\frac {d}{dt}\left(\frac{\partial L}{\partial v_i}\right)=\frac{\partial L}{\partial Q_i}$ leads to
$$\frac {d}{dt}\left(\frac{mv_i}{\sqrt{1-\frac{v^2}{c^2}}}+qA_i\right)=v_x\frac{\partial A_x}{\partial Q_i}+v_y\frac{\partial A_y}{\partial Q_i}+v_z\frac{\partial A_z}{\partial Q_i}.$$
Which is equivalent to $$\frac {d}{dt}\left(\frac{m\vec v}{\sqrt{1-\frac{v^2}{c^2}}}\right)=q\left(-\frac{\partial \vec A}{\partial t}-\vec \nabla \Phi + \vec v \times \left(\vec \nabla \times \vec A\right)\right).$$
Since other people brought up Hamiltonians, you can get a Hamiltonian as $H(\vec Q,\vec P,t)=\sqrt{(mc^2)^2+(\vec P-q\vec A)^2c^2}+q\Phi$ (which is approximately $mc^2 +(\vec P-q\vec A)^2/2m +q\Phi$ in the nonrelativistic limit). And we can denote $\vec p=\vec P -q\vec A$ as the kinetic momentum. And for people that bring up quantum theory into this, the canonical momentum is what obeys the canonical commutator relationship so since the kinetic momentum is $\vec p=\vec P -q\vec A$ the different components of the kinetic momentum do not commute with each other because of the vector potential term.
A: Since $P=p+qA$ commutes with $H={P^2}/2m$, it is a constant of the motion. But this is not true for $p$, so I have the impression that there is some confusion about $P$ and $p$.
A: I need the Latex environment to correct the answer provided by @Urgje, so forgive me for writing a new answer. As shown by Hitoshi, the commutator between the two components of kinetic momentum is:
$$[P_x,P_y]=i\frac{e\hbar}{c}B_z$$
Let's now show that the kinetic momentum does not commute with the Hamiltonian.
$$[P_x,P^2]=[P_x,(P_x^2+P_y^2)]=[P_x,P_y^2]=[P_x,P_y]P_y+P_y[P_x,P_y]=2i\frac{e\hbar}{c}B_zP_y\neq0$$
Similarly, $P_y$ doesn't commute with the Hamiltonian. Therefore, the kinetic momentum $\vec{P}\equiv(P_x,P_y)$ does not commute with the Hamiltonian $H=\frac{P^2}{2m}$. As a result, the kinetic momentum is not conserved! This is not surprising since in the classical system kinetic momentum is not conserved either. Remember that electrons in the classical system move in circular orbits.
