When a carboxylic acid with low molecular weight is heated with $\ce{P2O5}$ we get the corresponding anhydride. My book says that this reaction happens with dehydrating agents such as $\ce{P2O5}$. I have also learned from my teacher that $\ce{H2SO4}$ is also a good dehydrating agent.
My question is what makes a molecule a good dehydrating agent? How can I identify one (or maybe what are the common dehydrating agents?) while solving questions? Also
Also, I have seen the use of $\ce{P4O10}$, but do $\ce{P2O5}$ and $\ce{P4O10}$ play the same role as a reagent?