  Aims: Our goal is to study the chemical composition of the outflows of active
galactic nuclei and starburst galaxies.
  Methods: We obtained high-resolution interferometric observations of HCN and
HCO$^+$ $J=1\rightarrow0$ and $J=2\rightarrow1$ of the ultraluminous infrared
galaxy Mrk~231 with the IRAM Plateau de Bure Interferometer. We also use
previously published observations of HCN and HCO$^+$ $J=1\rightarrow0$ and
$J=3\rightarrow2$, and HNC $J=1\rightarrow0$ in the same source.
  Results: In the line wings of the HCN, HCO$^+$, and HNC emission, we find
that these three molecular species exhibit features at distinct velocities
which differ between the species. The features are not consistent with emission
lines of other molecular species. Through radiative transfer modelling of the
HCN and HCO$^+$ outflow emission we find an average abundance ratio
$X(\mathrm{HCN})/X(\mathrm{HCO}^+)\gtrsim1000$. Assuming a clumpy outflow,
modelling of the HCN and HCO$^+$ emission produces strongly inconsistent
outflow masses.
  Conclusions: Both the anti-correlated outflow features of HCN and HCO$^+$ and
the different outflow masses calculated from the radiative transfer models of
the HCN and HCO$^+$ emission suggest that the outflow is chemically
differentiated. The separation between HCN and HCO$^+$ could be an indicator of
shock fronts present in the outflow, since the HCN/HCO$^+$ ratio is expected to
be elevated in shocked regions. Our result shows that studies of the chemistry
in large-scale galactic outflows can be used to better understand the physical
properties of these outflows and their effects on the interstellar medium (ISM)
in the galaxy.

Astrophysics of Galaxies