Since there is no velocity in the Y-direction,
u=ux+uz and B=B0/x
equation of motion along x and z axis is
dvx/dt=-qB0vz/mx
dvz/dt=-qB0vx/mx
adding 1 and 2,
vx2+vz2=constant=v02
vz=√v02-vx2
substituting in equation 1, and re-writing,
vxdvx/dx=-qB0√v02-vx2/mx
Integrating we get,
√v02-vx2=qB0lnx+C
initial conditions are x=a, v=v0
Therefore,
C=qB0lnx/a
when velocity becums || to z-axis, vx=0
xmax=aemv0/qB0