Rotation of Taylor expansion of a scalar I have a scalar magnetic field in a volume expressed by the formula
$$B(x,y)=B_0 + \frac{\partial B}{\partial x}(x-x_0) + \frac{\partial B}{\partial y}(y-y_0)$$
which approximates the non-homogeneity of the magnetic field with linear gradients. This is defined in a specific frame of reference in one plane perpendicular to the $z$-axis. Multiple planes will provide the magnetic field in the volume. 
I need to rotate this formula around the $z$-axis with an angle $\phi$. Can this be done and how will the derivatives transform in this case? How will this be done with higher order derivatives (secondary question)?
 A: The solution I found is to rotate the gradient. If the gradient is defined by
$$\vec{\nabla}B=\frac{\partial B}{\partial x} \hat{x}+\frac{\partial B}{\partial y} \hat{y}+\frac{\partial B}{\partial z} \hat{z}$$
And we use the rotation matrix on that
$$R\cdot \vec{\nabla}B=\left(
\begin{array}{ccc}
 \cos (\phi ) & -\sin (\phi ) & 0 \\
 \sin (\phi ) & \cos (\phi ) & 0 \\
 0 & 0 & 1 \\
\end{array}
\right)\left(
\begin{array}{c}
 \frac{\partial B}{\partial x} \\
 \frac{\partial B}{\partial y} \\
 \frac{\partial B}{\partial z} \\
\end{array}
\right)=\left(\frac{\partial B}{\partial x}\cos\phi-\frac{\partial B}{\partial y}\sin\phi\right)\hat{x}+\left(\frac{\partial B}{\partial x}\sin\phi+\frac{\partial B}{\partial y}\cos\phi\right)\hat{y}$$
And now we substitute those gradients in the main expression of the Taylor expansion and rotate the offsets $x-x_0$ and $y-y_0$ around the point $(x_0,y_0)$:
$$B(x,y)=B_0 + \left(\frac{\partial B}{\partial x}\cos\phi-\frac{\partial B}{\partial y}\sin\phi\right)\left(x_0+(x-x_0)\cos \phi-(y-y_0)\sin \phi\right) + \left(\frac{\partial B}{\partial x}\sin\phi+\frac{\partial B}{\partial y}\cos\phi\right)\left(y_0 + (x-x_0)\sin \phi+(y-y_0)\cos \phi\right)$$
A: The magnetic field itself is not a scalar, it is a pseudo-vector. Therefore your formula seems to assume that the magnetic field is a scalar. Is that just a single component or is it the absolute value of the field?
If it is
$$ \vec B(x,y)=\vec B_0 + \frac{\partial \vec B}{\partial x}(x-x_0) + \frac{\partial \vec B}{\partial y}(y-y_0), $$
then you could apply a rotation matrix.
I have the impression that you could just add a term with $$\frac{\partial \vec B}{\partial z}(z-z_0)$$ to it and have an approximation in the whole of 3D.
If you just want to transform the derivatives, they transform inversely to the vector elements. So let $A$ be the rotation matrix for the angle $\phi$, then you need to transform the derivatives with $A^{\mathrm T}$, the transpose of that transformation.
Background: Partial derivatives are covectors and transform like so if you have a transformation that goes $\phi\colon x \mapsto y$ with $x = \phi(y)$:
$$\frac{\partial}{\partial y^\mu} = \frac{\partial x^\alpha}{\partial y^\mu} \frac{\partial}{\partial x^\alpha} $$
