  Principal Component Analysis (PCA) is an efficient tool to optimize the
multiparameter tests of general relativity (GR) where one tests for
simultaneous deviations in multiple post-Newtonian (PN) phasing coefficients by
introducing fractional deformation parameters. We use PCA to construct the
`best-measured' linear combinations of the PN deformation parameters from the
data. This helps to set stringent limits on deviations from GR and detect
possible beyond-GR physics. In this paper, we study the effectiveness of this
method with the proposed next-generation gravitational wave detectors, Cosmic
Explorer (CE) and Einstein Telescope (ET). Observation of compact binaries with
total masses between 20-200 $\mathrm{M}_{\odot}$ in the detector frame and at a
luminosity distance of 500 Mpc, CE can measure the three most dominant linear
combinations to an accuracy better than 10%, and the most dominant one to
better than 0.1%. For specific ranges of masses and linear combinations,
constraints from ET are better by a few factors than CE. This improvement is
because of the improved low frequency sensitivity of ET compared to CE (between
1-5 Hz). In addition, we explain the sensitivity of the PCA parameters to the
different PN deformation parameters and discuss their variation with total
mass. We also discuss a criterion for quantifying the number of most dominant
linear combinations that capture the information in the signal up to a
threshold.
