I have been given following problem $$ \min _{\mathbf{x}_2 \in \mathbb{R}^k}\left(\min _{\mathbf{x}_1 \in \mathbb{R}^n}\left\|\mathbf{y}-\mathbf{A} \mathbf{x}_1-\mathbf{B} \mathbf{x}_2\right\|_2^2\right) $$ where $\mathbf{A} \in \mathbb{R}^{m \times n}$ and $\mathbf{B} \in \mathbb{R}^{m \times k}$. Suppose that $\mathbf{A}$ has full column rank, and $\mathbf{P}_{\mathbf{A}}^{\perp} \mathbf{B}$ has full column rank. Using Least Squares $\mathrm{x}^*$ solution to the above problem is $$ \mathbf{x}_2^*=\left(\mathbf{B}^T \mathbf{P}_A^{\perp} \mathbf{B}\right)^{-1} \mathbf{B}^T \mathbf{P}_{\mathbf{A}}^{\perp} \mathbf{y} $$
How does one go about solving this problem?
One approach I thought of is to optimize over $\mathbf{x}_1$ first giving
$$\mathbf{x}_1^* = (\mathbf{y}-\mathbf{B}\mathbf{x}_2)^\dagger \mathbf{A}$$
But this doesn't seem to be taking me anywhere help is much appreciated. Thanks!