\section{Introduction} \label{sec:intr}
Prospects of cosmic shear for cosmology \citep{hu99, hutegmark99,
hu02, huterer02, heavens03, refregier03, benabed04, ishak04, sk04,
takadajain04, takadawhite04, knox05b} have inspired many
on-going and future weak lensing surveys such as the Deep Lens
Survey\footnote{See \url{http://dls.physics.ucdavis.edu.}},
Canada France Hawaii Telescope Legacy
Survey\footnote{See \url{http://www.cfht.hawaii.edu/Science/CFHLS/.}},
and the Large Synoptic Survey
Telescope\footnote{See \url{http://www.lsst.org.}}
\citep[LSST,][]{tyson03}.

The statistical properties of cosmic shear maps depend on the
distances to the lenses and sources.  With the redshifts of
the source galaxies determined, the data can thus be
used to constrain dark energy parameters via their influence
on the distance-redshift relation \citep*{simpson05,knox05b}.
Because the source galaxies
are faint and numerous their redshifts will be estimated from
multi-band imaging data (photometric redshifts) rather
than from spectroscopic data (spectroscopic redshifts).  For redshift
uncertainties not to degrade the constraints on dark energy parameters
one must know the rms photometric redshift error and any biases very
accurately (\citealt{bernstein04}; \citealt{huterer05b};
\citealt{ishak05}; \citealt*{ma05}).

Photometric redshifts are traditionally calibrated with spectroscopy
of a subset of the imaged galaxies. One needs a very large and fair
sample though in order to achieve a sufficiently accurate calibration.
For example, to reduce the uncertainties of the rms photometric
redshift error to 1\%, a minimum of 5000
spectra are required in each redshift bin and ideally for each
spectral type of galaxy. This is achievable at low redshift, but it becomes
prohibitively expensive toward high redshifts for the magnitude limits
of the deepest planned surveys.  Moreover, photometric
redshift errors are not Gaussian; the distributions tend to have long
tails.  This means that the rms value may not be
sufficient for characterizing photometric errors and that one needs
an even larger spectroscopic subsample to map the full error
distribution. Thus, it remains a challenge for very deep surveys to
calibrate their photometric redshifts with sufficient accuracy.

However this challenge is met,
we expect that independent cross checks capable of revealing
inconsistencies with their nominal error distributions.
will be very valuable.  The clustering properties of galaxies
in redshift space provide us with such an opportunity.
Photometric redshift errors, like peculiar velocities, alter
the galaxy power spectrum in redshift space. Specifically, they
strongly suppress the power spectrum along the line of sight.
The amount of suppression is exponentially sensitive to the rms
photometric redshift error (e.g.~\citealt{se03}, hereafter SE03;
\citealt{zhan05}). Thus, one can use the three-dimensional galaxy
power spectrum to quantify photometric redshift errors and,
consequently, prevent weak lensing statistics from severe degradation.

The clustering properties of the galaxies are also dark energy
probes in their own right.
The features in the galaxy power spectrum (the broadband shape and
baryon acoustic oscillations)
\citep{py70, be84, h89, hs96, cpp05, ezh05, huetsi05} can be used
as CMB-calibrated standard rulers
for determining the angular-diameter distance $D(z)$ and
constraining dark energy (\citealt*{eht98}; \citealt{bg03};
\citealt{hh03}; \citealt{l03}; SE03; \citealt{abf05}).

Several papers have studied the prospects for measuring
baryon acoustic oscillations from photometric surveys
\citep*[SE03;][]{bb04, djt04, gb05, linder05}. The main advantage
of a photometric redshift survey, is the wide coverage, which
reduces the sample variance error, and deep photometry, which
leads to more galaxies and therefore lower shot noise.

The challenges for large photometric redshift surveys include
redshift errors, dust extinction, galaxy bias,
redshift distortion and nonlinear evolution \citep{zhan05}.
These non-idealities do not produce strong oscillating features in
the power spectrum (similar to the baryon oscillations) and can be
controlled, despite some degradation to the measurements
\citep{se05, white05, zhan05}.

Ideally, the clustering properties of the galaxies would be adequate
to simultaneously constrain dark energy and the error distribution
of the photometric redshift errors.  As we show below though,
such a self-calibration does not achieve a sufficiently accurate
reconstruction of the photometric redshift error distribution.
However, the clustering properties of the galaxies {\em can} provide
a valuable, though somewhat model-dependent, consistency test.

In section 2 we present our method for forecasting constraints on
cosmological parameters as well as parameters of the redshift error
distribution.  In Section 3 we show how well the rms photometric
redshift error can be estimated given the knowledge of the Hubble
parameter $H(z)$, and vice versa. We then demonstrate that mean
redshifts can be accurately determined from the same data.
In Section 4 we forecast constraints on dark energy
from the broadband shape and baryon oscillations in the galaxies of
the LSST survey. Since the constraints from the former alone are
sub-dominant to those from the latter (SE03), hereafter we only
refer to baryon oscillations even though the broadband shape is
always included in our analysis.
In Section 5 we discuss these results
and conclude.

\section{Method} \label{sec:method}
SE03 developed a two-stage Fisher matrix analysis to forecast
errors on dark energy equation of state (EOS) parameters from
baryon oscillations.
We adopt their method with improvements and constrain photometric
redshift errors at the same time.

In the first stage of the SE03 analysis $H_i$ and $D_i$, where
$H_i \equiv H(z_i)$, $D_i \equiv D(z_i)$, and
$z_i$ is the mean redshift of the $i$th bin of galaxies, are treated
as free parameters and their Fisher matrix is calculated.  In the
second stage, constraints on the matter density $\omega_{\rm m}$,
the comoving angular diameter distance to the last scattering
surface $D_{\rm CMB}$, $H_i$ and $D_i$ are converted
to constraints on dark energy parameters.
The point of dividing the analysis into two stages is to allow
one to better understand how the dark energy constraints are arising.

\subsection{Observed Galaxy Power Spectrum}

Using a fiducial cosmological model as reference, we can
write the observed galaxy power spectrum as
\begin{eqnarray} \label{eq:Pg}
P_{\rm g}(k_{{\rm f}\perp},k_{{\rm f}\parallel})
=&&\frac{D_{\rm f}^2 H}{D^2 H_{\rm f}}
\left(1+\beta\frac{k^2_\parallel}{k^2_\perp + k^2_\parallel}
\right)^2  \\ && \times
\big|\tilde W(c^2 \sigma_z^2 k_\parallel^2 / H^2)\big|^2
b^2 G^2 P(k) +P_{\rm s}, \nonumber
\end{eqnarray}
where $\beta$
is the linear redshift distortion parameter \citep{k87},
$\sigma_z = \sigma_{z0}(1+z)$ is
the rms photometric redshift error, $b$ is the galaxy clustering
bias, $G$ is the linear growth function, $P(k)$ is the matter power
spectrum at $z = 0$, and $P_{\rm s}$ is the shot noise.
We have suppressed the argument $z$ in functions $D$, $D_{\rm f}$,
$H$, $H_{\rm f}$, $\beta$,
$\sigma_z$, $b$, and $G$ for convenience. The true
wavenumbers $k_\perp$ and $k_\parallel$ are related to the fiducial
ones by
\begin{equation}
k_\perp = k_{\rm f\perp} D_{\rm f} / D \mbox{\, and \,}
k_\parallel = k_{\rm f\parallel} H / H_{\rm f}.
\end{equation}

The window function, $\tilde W$, in Eq.~(\ref{eq:Pg}),
is the Fourier transform in the radial direction of the real-space window function,
$W$, which is the distribution of galaxies at true distance $r$
given their estimated distance of $\bar r$.
With the assumption that this distribution has the form
\begin{equation}
P(r | \bar r) = W\left(\left(r-\bar r\right)/\sigma_r\right)
\end{equation}
the modulus of the Fourier transform only depends on $k_\parallel \sigma_r =
k_\parallel c\sigma_z/H$.  If we further assumed a normal distribution
then $|\tilde W|^2 = e^{-c^2 \sigma_z^2 k_\parallel^2 / H^2}$ and
Eq.~(\ref{eq:Pg}) would be the same as in SE03.

In all our calculations, for simplicity, we do assume a normal distribution
for the redshift errors.  But in general redshift errors are significantly
non-Gaussian.  Typically
photometric redshift errors have long tails due to the fraction of redshift
assignments that fail catastrophically.  However, as can be seen from
Eq.~(\ref{eq:Pg}) any non-Gaussianity has its impact on the observed galaxy
power spectrum and, in principle, by assuming the isotropy of $P(k)$,
one can reconstruct the function $\tilde W$ from the anisotropy of the
observed galaxy power spectrum.  Of course, with greater freedom allowed
in the functional form of the redshift error distribution, the quality of
the reconstruction will be weakened.

\citet{s04} points out that the \citet{k87} formula for the linear
redshift distortion [used in Eq.~(\ref{eq:Pg})] may not
be sufficiently accurate for the precision measurements we consider here.
Fortunately, the effect of redshift distortion can be readily calibrated
through $N$-body simulations. Meanwhile, one can also quantify the window
function $W$ by assigning realistic redshift errors to mock galaxies
drawn from the simulations. Precisely calibrated matter power spectra
are, in fact, required for interpreting weak lensing data \citep*{white04,
zhan04, huterer05a, hagan05}. As such, calibrating the effects of redshift
distortion and photometric redshift errors can be achieved from the same
set of simulations without much difficulty.

Although we treat them as constant across each redshift bin,
all the functions ($D$, $D_{\rm f}$, $H$, $H_{\rm f}$,
$\beta$, $\sigma_z$, $b$, and $G$) in equation (\ref{eq:Pg}),
as well as the survey selection function, can
change considerably within a single redshift bin.
As such, the observed galaxy power spectrum in a redshift bin
becomes a convolution of equation (\ref{eq:Pg}) with another
window function that accounts for the radial evolution
\citep[e.g., as treated in][]{zhan05}. We avoid this complication
for simplicity, although the appropriate treatment is straightforward
as long as the true evolution within each bin is known, or can
be parameterized.

The sub-bin evolution we are most concerned with is that of the
clustering bias.  The variation will be caused in part by
any redshift dependence of the selection function.  Even if one
were selecting the same distribution of galaxy types at
each redshift, bias would change due to the intrinsic evolution of
the population.  Most importantly, redshift
errors might actually be correlated with bias fluctuations
since both can be caused by spectral type errors
\citep{padmanabhan05b}.  We do not yet know the magnitude
of these effects and the extent to which they can be controlled.

\subsection{Fisher Matrix} \label{sec:fish}
For the stage I analysis, our complete parameterization of the observables
includes more than just $H_i$ and $D_i$.  There are
four other parameters in each redshift bin: $\ln(G_ib_i)$, $\ln\beta_i$,
$P_{{\rm s},i}$ and $\ln{\sigma_{z,i}}$, where $i$ refers to the $i$th
redshift bin, and seven redshift-independent parameters.
We do not include the redshift bias parameters, $\delta z_i$, at
this stage because they have no influence on the observed power spectra
except through $H_i$ and $D_i$, which are independent parameters in stage I.
They will be included in stage II. For brevity, we suppress the subscript
$i$ in what follows.

The seven redshift-independent parameters are the matter density
$\omega_{\rm m}$, the baryon density $\omega_{\rm b}$,
the redshift of reionization $z_{\rm rei}$, the primordial helium mass
fraction $y_{\rm p}$, the spectral tilt $n_{\rm s}$, the normalization
of the primordial potential power spectrum $k_0^3P_{\Phi 0}$, and
the angular size of the sound horizon at the last
scattering surface $\theta_{\rm s}$.

There are three major difference between our choice of parameters and that
of SE03.  First, we do not include the matter fraction
$\Omega_{\rm m}$ because at fixed $\theta_{\rm s}$ and $\omega_{\rm m}$
it affects neither the CMB observables nor the
matter power spectrum.  Second,
we use $\ln Gb$ instead of $\ln G$ because the galaxy clustering
bias is degenerate with the growth function. And third, we include
additional parameters $\ln \sigma_z$ (stage I) and $\delta z$
(stage II) in each redshift bin. We also replace $D_{\rm CMB}$ in SE03
with $\theta_{\rm s}$ for convenience, which is not critical.

As the cosmic density field evolves, nonlinear
effects become important on larger and larger scales.
To prevent these effects from contaminating the measurements of
baryon oscillations, we only use the Fourier modes at
$k < k_{\rm max}$ in our analysis, where $k_{\rm max}$ ranges from
0.12 to 0.53 \mbox{$h$\,Mpc$^{-1}$}{} between $z = 0.31$ and $2.66$ (see
Table~\ref{tab:err}). Evidence from the 2-degree Field Galaxy Redshift
Survey and the Sloan Digital Sky Survey suggests that the
galaxy clustering bias at $z \sim 0.1$, despite some dependence on
luminosity, is scale-independent on scales $k$ less than a few tenths
\mbox{$h$\,Mpc$^{-1}$}{} \citep[e.g.][]{verde02, tegmark04}.
Hence, the upper bound in wavenumber also ensures that we can model
the galaxy bias as a time-evolving but scale-independent quantity.
For simplicity, our fiducial model has a bias $b(z) = 1 + 0.84 \, z$
for all galaxies.  It is straightforward to model the bias for
each sub-sample of galaxies separately. In fact, it is beneficial to
divide the galaxies into sub-samples, especially at low redshift
where galaxy number density is high, because one can control
photometric redshift errors much better for a homogeneous sample of
galaxies \citep[e.g.][]{pbs05}.

We assume that the primordial potential power spectrum
$k^3P_{\Phi}^i(k) = k_0^3P_{\Phi 0} (k/k_0)^{n_{\rm s}-1}$.
Our fiducial model is a low density and flat cold dark matter
universe with a cosmological constant. It has
$(\omega_{\rm m}, \omega_{\rm b}, z_{\rm rei},
y_{\rm p}, n_{\rm s}, k_0^3P_{\Phi 0}, \theta_{\rm s}) =
(0.146, 0.021, 6.3, 0.24, 1.0, 6.4 \times 10^{-11}, 0.60 \ {\rm deg})$
and the reduced Hubble constant $h = 0.655$.

We calculate the Fisher matrix using the approximation \citep{t97}
\begin{equation} \label{eq:Fij}
F_{ij} = \int \frac{1}{2}
\frac{\partial \ln P(\mathbf{k}_{\rm f})}{\partial p_i}
\frac{\partial \ln P(\mathbf{k}_{\rm f})}{\partial p_j}
V_{\rm eff}(\mathbf{k}_{\rm f})
\frac{{\rm d} \mathbf{k}_{\rm f}}{(2 \pi)^3},
\end{equation}
where $p_i$ is the $i$th parameter,
\begin{equation} \label{eq:Veff}
V_{\rm eff}(\mathbf{k}) = \int \left [
\frac{{n}(\mathbf{r})P_{\rm g}(\mathbf{k})}
{{n}(\mathbf{r})P_{\rm g}(\mathbf{k})+1}
\right ]^2 {\rm d} \mathbf{r}
\end{equation}
is the effective volume of the survey \citep{fkp94}, and
$n(\mathbf{r})$ is the galaxy number density. The marginalized
error of the $i$th parameter is given by
$[(F+F_{\rm P})^{-1}]^{1/2}_{ii}$.  Here, $F_{\rm P}$ is for any prior
information.  If we already know, prior to examining
the data, the value of parameter $p_i$ to within $\pm \sigma_{\rm P}(p_i)$ then
$(F_{\rm P})_{ii} = 1/\sigma_{\rm P}^2(p_i)$.

In the second stage, our ``observables" are
$\omega_{\rm m}$, $\theta_{\rm s}$, $D$'s, and $H$'s
with their covariance matrix as calculated from the stage I
Fisher matrix, marginalizing over all the other parameters.
From these observables, and their covariance matrix, we forecast
how well one can determine the following parameters:
the photometric redshift biases $\delta z$,
$\omega_{\rm m}$, $\Omega_{\rm DE}$,
$w_0$, and $w_{\rm a}$, where the dark energy EOS is parametrized as
$w(z) = w_0 + w_{\rm a}[1 - (1 + z)^{-1}]$.
To explicitly define the redshift bias parameters we write
the probability that a galaxy with photometric
redshift estimate $z_{\rm p}$ has a true redshift in between
$z$ and $z+{\rm d}z$ as
\begin{equation}
{\rm d}P(z)  =  \frac{1}{\sqrt{2\pi}\,\sigma_z}
\exp\left[-\frac{(z +  \delta z - z_{\rm p})^2}
{2\sigma_z^2}\right]  {\rm d}z.
\end{equation}

\begin{deluxetable*}{l c c c c c c c }
\tablewidth{0pt}
\tablecaption{Marginalized Errors of Selected Stage I Parameters \\
with Complete Self-Calibration from LSST
\label{tab:err}}
\tablehead{\colhead{\phd $z$} & \colhead{$k_{\rm max}$}  &
\colhead{\phd $\sigma(\ln D)$\tablenotemark{a}} &
\colhead{$\sigma(\ln H)$\tablenotemark{a}} &
\colhead{$\sigma(\ln H)$\tablenotemark{b}} &
\colhead{$\sigma(\ln \sigma_z/H)$\tablenotemark{a,c}} &
\colhead{\phd $\sigma(\ln \beta)$\tablenotemark{a}} &
\colhead{\phd $\sigma(\ln Gb)$\tablenotemark{a}} \\
\cline{3-8}
\colhead{} & \colhead{($h$\,Mpc$^{-1}$)} &
\multicolumn{6}{c}{($\times 100$)} }
\startdata
0.31 & 0.12 & \phn 2.9 & 27 & 1.1 & 0.37 & \phd 24 & \phd 13 \\
0.55 & 0.14 & \phn 1.7 & 19 & 1.0 & 0.21 & \phd 17 &     9.5 \\
0.84 & 0.17 &     0.75 & 14 & 1.0 & 0.14 & \phd 13 &     7.1 \\
1.18 & 0.21 &     0.57 & 12 & 1.0 & 0.11 & \phd 11 &     6.2 \\
1.59 & 0.28 &     0.43 & 10 & 1.0 & 0.10 &     9.4 &     5.2 \\
2.08 & 0.38 &     0.39 & 11 & 1.0 & 0.11 & \phd 10 &     5.5 \\
2.66 & 0.53 &     0.43 & 12 & 1.0 & 0.15 & \phd 13 &     6.4
\enddata
\tablenotetext{a}{
No prior is taken for the rms photometric redshift error or the
Hubble parameter. The constraints are poorer at low redshift due
to small volumes and low $k_{\rm max}$ and then are poorer at high
redshift due to low galaxy number densities.}
\tablenotetext{b}{
We assume $\sigma_{\rm P}(\ln \sigma_z) = 0.01$ for this column.
The prior sets the precision of $H$,
reduces uncertainties of $\beta$ and $Gb$ significantly, and
renders little improvement to other parameters. }
\tablenotetext{c}{
For this column, the parameter $\ln \sigma_z$ in the Fisher
matrix is replaced by $\ln \sigma_z/H$. With this
parametrization, the constraints on other parameters change
slightly. }
\end{deluxetable*}

\subsection{Tests} \label{sec:test}
We test our procedures using the baseline surveys of SE03. In
order to compare with their results, we do not include photometric
redshift parameters and do not differentiate the photometric
redshift term $e^{-c^2 \sigma_z^2 k_\parallel^2 / H^2}$ with
respect to $H$ in the Fisher matrix. We also adopt SE03
parametrization of the dark energy EOS in this test. The resulting
uncertainties on $D$ and $H$ match those in SE03 within a factor
of $1.2$ ($1.45$) for the spectroscopic (photometric) baseline
survey. Our error forecasts on dark energy parameters are
$30\%$--$50\%$ larger than those in SE03 because of the
larger errors we obtain for $D$ and $H$.

If we include the derivative of the photometric redshift term
$e^{-c^2 \sigma_z^2 k_\parallel^2 / H^2}$ with respect to
$H$ in the Fisher matrix, then the constraints on $H$ and dark
energy EOS parameters are nearly as good as those from the
spectroscopic baseline survey. This is because the shape of the
observed galaxy power spectrum is exponentially sensitive to the
Hubble parameter. Such sensitivity imposes a strong constraint on
$H$ and subsequently on dark energy EOS parameters. However,
the strong constraint is actually on the comoving length scale of
the rms photometric redshift error $c \sigma_z/H$. In
reality, the uncertainty of $\sigma_z$ will degrade the
constraint on $H$. In fact, if we also include $\ln \sigma_z$
in the parameter set, the constraints become as
weak as those from the photometric baseline survey in the previous
paragraph. Thus, we conclude that the photometric
results in SE03 are equivalent to having an imprecise prior
on $\sigma_z$; i.e., letting $\sigma_z$ float freely.

\section{Results for Redshift Parameters}
\label{sec:photoz}

We assume that through some external calibration process we
have estimates of both the distribution of errors about the mean redshift
as well as the mean redshift.  A central point of our paper
is that one can use the clustering properties of the galaxies
themselves to test these
externally-derived mean redshifts.  To explain how it works, let
us assume that the distribution of errors is Gaussian with variance
$\sigma_z^2$.  The redshift errors lead to a suppression of the fluctuation
power of radial modes by an amount $\exp(-c^2\sigma_z^2k_\parallel^2/H^2)$.
With
$\sigma_z$ known, one can thus determine $H$.  Analyzing the power spectra
of a sequence of galaxy groupings, each with mean redshifts, $z_{\rm m}$,
we thus know $H(z_{\rm m} - \delta z)$ for each group of galaxies.
From the standard ruler provided by the baryon oscillations, we
can also determine $D(z_{\rm m} - \delta z)$.  With
some assumptions about the smoothness of $H$, and using the fact that
$D = c \int dz/H$, these values of $D$ and $H$ will not be consistent with
each other for all possible values of $z_{\rm m} - \delta z$.
Thus we can determine these mean redshifts and check to see if they are
consistent with the mean redshifts inferred from the external calibration.

Even if we do not use the external calibration to tell us $\sigma_z$,
from the galaxy power spectra we can still determine the source
distance rms $\sigma_r = c \sigma_z/H$ to much better than $1\%$
(see Table~\ref{tab:err}).  Fortunately, this is
exactly the quantity we want for interpretation of weak lensing
power spectra, since the weak lensing power spectrum for sources
with mean redshift $z$ depends on how the sources are distributed
in real space, not redshift space.

In this section we investigate quantitatively how well one can measure
$\sigma_z$, given $H$ (and vice-versa), perform the redshift
bias consistency test and determine $\sigma_z/H$.
For specificity, we adopt for this section and the next a model of the
proposed survey by LSST as our fiducial survey.  We assume a survey area
of $23,000$ square degrees with galaxy distribution
\begin{equation}
n(z) = 640 z^2 e^{-z / 0.35}\ \mbox{arcmin}^{-2},
\end{equation}
which corresponds to a projected number density of 55
\mbox{arcmin$^{-2}$}. We use $\sigma_{z0} = 0.04$
as our fiducial rms photometric redshift error.
The survey is divided into 7 redshift bins from $z = 0.2$ to
$3$ each with roughly the same comoving radial extent.
The mean redshifts of the redshift bins are listed in
Table~\ref{tab:err}.

For the CMB we assume {\it Planck} as treated in \citet*{kaplinghat03}.
{\it Planck} observes at 9 different frequency channels from 30 to 850
GHz. To crudely model the effects of foregrounds we assume the
temperature maps at 100, 143 and 217 GHz can be perfectly cleaned
of foregrounds by use of the other channels and for polarization
we keep just the 143 and 217 GHz channels.  We assume this can
be done over 80\% of the sky up to $l_{\rm max} =
2000$ for temperature and $l_{\rm max} = 2500$ for polarization.

\subsection{rms Photometric Redshift Error and $H$} \label{sec:szh}

We first implement the full procedure described in Section
\S~\ref{sec:method} with a prior on the Hubble parameter
$\sigma_{\rm P}( \ln H)$. For a simple demonstration, we apply the same
prior to all redshift bins. The results for four of the
redshift bins are shown in
Fig.~\ref{fig:szh}.  The other three are suppressed for clarity.
As expected, the prior
on $H$ sets directly the uncertainty of the rms photometric
redshift error, i.e.~$\sigma(\ln \sigma_z) = \sigma_{\rm P}(\ln H)$,
over a wide range. One is limited by the uncertainty of the
combination $\sigma_z/H$ when the prior
$\sigma_{\rm P}( \ln H)$ is stronger than the constraint
$\sigma[\ln (\sigma_z/H)]$, so that $\sigma_{\rm P}( \ln H)$
can no longer improve the precision of $\sigma_z$.
On the other hand, $\sigma(\ln \sigma_z)$ does not degrade
further when the prior is worse than what can be determined from
the survey itself. Hence, the
$\sigma(\ln \sigma_z)$--$\sigma_{\rm P}( \ln H)$
curves in Fig.~\ref{fig:szh} flatten on both sides.

A prior on the Hubble parameter could potentially come from a
spectroscopic galaxy
survey such as that planned with the Kilo-Aperture Optical
Spectrograph\footnote{See http://www.noao.edu/kaos/.}.  KAOS will
be able to survey enough volume to determine the Hubble
parameter at $z \sim 1$ and 3 to a few percent from baryon
oscillations (SE03).

On the other hand, we may take a prior on $\sigma_z$ from a
spectroscopic calibration of the photometric redshifts. We have
thus also calculated the effect of a prior on the rms photometric
redshift error $\sigma_{\rm P}(\ln \sigma_z)$ on our ability
to determine $H$.  Again, the same prior was taken for the
seven redshift bins.  The results are almost identical
to those in Fig.~\ref{fig:szh} but with x-axis label becoming
$\sigma_{\rm P}(\ln \sigma_z)$ and the y-axis label
$\sigma(\ln H)$, because $\sigma_z$
and $H$ are degenerate in the photometric suppression
$e^{-c^2 \sigma_z^2 k_\parallel^2 / H^2}$.

\begin{figure}
\centering
\includegraphics[width=72mm]{f1}
\caption[f1]{Fractional errors on the rms photometric redshift
error $\sigma(\ln \sigma_z)$ as a function of the prior on the
Hubble parameter $\sigma_{\rm P}(\ln H)$ in four of the seven redshift bins
assuming the fiducial LSST survey.  On the left side, the
prior is better than the constraint of the combination
$\sigma_z/H$ (see Table~\ref{tab:err}), so that it can no longer
improve the precision
of $\sigma_z$. Whereas, on the right side, the prior is not
useful because the survey constrains $H$ better than the prior, i.e.
it reaches self-calibration.
In the middle, one has $\sigma(\ln \sigma_z) = \sigma_{\rm P}(\ln H)$ as
expected. The uncertainty of $H$ as a function of the prior on
$\sigma_z$ look identical to this figure except the x-axis
label becomes $\sigma_{\rm P}(\ln \sigma_z)$ and the y-axis
label $\sigma(\ln H)$.
\label{fig:szh}}
\end{figure}

\subsection{Photometric Redshift Bias}

In stage II of the Fisher matrix analysis, we include
redshift biases $\delta z$.
These redshift biases will cause inconsistencies between
the angular diameter distance and Hubble parameter in a given
cosmological model, given some assumptions about the smoothness
of $H$.  In our analysis, those smoothness assumptions are
provided implicitly by modeling the dark energy density as
a smoothly varying function, controlled by EOS parameters $w_0$ and
$w_{\rm a}$.

The resulting constraints on the photometric redshift biases are
shown in Fig.~\ref{fig:zbias} as a function of the input prior
$\sigma_{\rm P}(\ln \sigma_{\rm z})$, which is the same in all
redshift bins. With $\sigma_{\rm P}(\ln \sigma_{\rm z}) \sim 0.01$
the biases are determined to better than 0.01.
For the 4,000 sq. degree cosmic shear survey considered by
\citet{ma05}, these bias constraints are sufficient to keep
the degradation in $w_0$ and $w_{\rm a}$ errors at the 20\% and 50\%
levels respectively.  However, because the larger LSST cosmic shear
survey can achieve stronger constraints on $w_0$ and $w_{\rm a}$ (given perfect
redshift information), the degradation in $w_0$ and $w_{\rm a}$ in this
case is worse:  factors of 2.5 and 3 respectively\footnote{Zhaoming
Ma, private communication.}.  This degradation is much better though
than the factor of ~10 degradation in $w_0$ and $w_{\rm a}$ that occur
without any prior on the redshift biases.

At low $\sigma_{\rm P}(\ln{\sigma_z})$ the quality of the constraint
as a function of $z$ peaks at
intermediate redshifts, due to the similar behavior for the
constraints on $D$ and $H$ (see Table~\ref{tab:err}).

\begin{figure}
\centering
\includegraphics[width=72mm]{f2}
\caption[f2]{Forecasted errors on $\delta z$ given varying priors
on $\sigma_z$. At low $\sigma_{\rm P}(\ln{\sigma_z})$ the quality
of the constraint as a function of $z$ peaks at
intermediate redshifts, due to the similar behavior for the
constraints on $D$ and $H$ (see Table~\ref{tab:err}).
\label{fig:zbias}}
\end{figure}

\section{Dark Energy Constraints from LSST Baryon Acoustic
Oscillations} \label{sec:lsst}

While the constraints on $\sigma_z$ and $\delta z$ from galaxy
power spectra discussed in Section~\ref{sec:photoz} will be useful
for extracting dark energy constraints from cosmic shear data, we
also explore how well dark energy information can be extracted
from the galaxy power spectra themselves.

In Figures ~\ref{fig:contw0} and ~\ref{fig:contwa} we see contours
of constant forecasted errors in $w_0$ and $w_{\rm a}$ as the
redshift priors are varied.  The same priors
are applied to all redshift bins for simplicity. As expected,
the galaxy power spectrum alone provides for only a very weak
self-calibration; as the prior on rms redshift errors is relaxed
to $100\%$ and that on redshift biases to $0.1$,
the errors degrade by factors of 20
to 40.  Also as expected, we do see though that with a strong prior
on $\sigma_z$, one does not need a prior on the $\delta z$ parameters.

From Fisher matrix calculations like those in Section~\ref{sec:photoz}
we find that the Hubble parameter does not significantly improve the
constraints on dark energy EOS parameters unless it is determined with
precision comparable to or better than those of the angular
diameter distance.  This means that one must achieve
$\sigma(\ln H) \lesssim 1\%$, which is possible, as discussed in
Section~\ref{sec:szh}, with a prior of
$\sigma_{\rm P}(\ln \sigma_z) \lesssim 1\%$.

\begin{figure}
\centering
\includegraphics[width=72mm]{f3}
\caption[f3]{Contours of constant forecasted errors in $w_0$ estimated
from galaxy clustering in the LSST survey as priors on
$\delta z$ and $\sigma_z$ are varied.  The same priors
are applied to all redshift bins for simplicity.
\label{fig:contw0}}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=72mm]{f4}
\caption[f4]{As in Fig.~\ref{fig:contw0}, but the contours
are for constant error in $w_{\rm a}$.
\label{fig:contwa}}
\end{figure}

We show LSST baryon oscillation constraints on $w_0$ and
$w_{\rm a}$ in Fig.~\ref{fig:lsstw0wa} for two cases:
$[\sigma_z, \sigma_{\rm P}(\ln \sigma_z), \sigma_{\rm P}(\delta z)]
= (0.04, 0.01, 0.01)$ (dashed line) and
$(0.08, 0.005, 0.08)$ (solid line).
By reducing $\sigma_{\rm P}(\ln \sigma_z)$ from $0.01$ to $0.005$
one tightens the constraints considerably, even though the
rms photometric redshift error is increased. This example
demonstrates that a large rms
photometric redshift error can be tolerated as long as it is
known accurately.

\begin{figure}
\centering
\includegraphics[width=72mm]{f5}
\caption[f5]{Marginalized $1\sigma$ error contours in the
$w_0$--$w_{\rm a}$ plane. The contours for LSST baryon
acoustic oscillations are shown for
$[\sigma_z, \sigma_{\rm P}(\ln \sigma_z), \sigma_{\rm P}(\delta z)]
= (0.04, 0.01, 0.01)$ (dashed line) and $(0.08, 0.005, 0.08)$
(solid line). For comparison, we include the
error ellipses from the power spectra of LSST tomographic cosmic shear
maps (dotted line) and 2000 supernovae as might be observed
by the Joint Dark Energy Mission
\citep[dash-dotted line,][]{knox05a}.
Note that the weak lensing constraints, unlike the baryon oscillation
constraints, do not included the effects of redshift error distribution
uncertainties.
\label{fig:lsstw0wa}}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=72mm]{f6}
\caption[f6]{As in Fig.~\ref{fig:lsstw0wa}, but the two larger
error contours are obtained without differentiating the photometric
suppression term $\exp(-c^2 \sigma_z^2 k_\parallel^2 / H^2)$ with
respect to the Hubble parameter $H$ in the Fisher matrix in stage I.
The rms photometric redshift error is assumed to be
$\sigma_z = 0.04(1+z)$, and it is not included as parameters.
In stage II, the same prior
is applied to the photometric redshift bias in each redshift bin.
The solid contour corresponds to $\sigma_{\rm P}(\delta z) = 0.01$,
and the dotted contour $\sigma_{\rm P}(\delta z) = 0.001$.
The constraints do not improve for
$\sigma_{\rm P}(\delta z) \lesssim 0.001$ or degrade much for
$\sigma_{\rm P}(\delta z) \gtrsim 0.008$. The dashed contour is
from Fig.~\ref{fig:lsstw0wa} for
$[\sigma_z, \sigma_{\rm P}(\ln \sigma_z), \sigma_{\rm P}(\delta z)]
= (0.04, 0.01, 0.01)$.
\label{fig:selimit}}
\end{figure}

We also show in Fig.~\ref{fig:lsstw0wa} the constraints from
the power spectra of LSST tomographic cosmic shear maps (dotted line)
and 2000 supernovae as might be observed by the Joint Dark
Energy Mission \citep*[dash-dotted line,][]{knox05a}.  Note that
these weak lensing error forecasts are done in the limit of perfect
prior knowledge of the redshift error distribution parameters.  If we
were to use the priors on these parameters adopted for the baryon
oscillation calculations, the weak lensing constraints would become
slightly looser than the baryon oscillation constraints.

One may attempt to combine all the three constraints together
to achieve higher precision.  However, further work is needed
to carefully account for the correlation between
baryon oscillations and weak lensing statistics, because they
overlap in both observational data and underlying density field
\citep[e.g.][]{hu04}.

As mentioned earlier, we cannot yet be completely sure that the sub-bin evolution
of galaxy bias can be controlled well enough to make an accurate
determination of $\tilde W(c\sigma_z k_\parallel/H)$, the suppression of
power in the radial direction.  If we are not able to extract the
information about the shape of the window function and, therefore,
$\sigma_z/H$, then even with a prior on the redshift
error distribution from external calibration our determination of $H(z)$
will be degraded as discussed in Section~\ref{sec:szh}.  We show in
Fig.~\ref{fig:selimit} how the error contours degrade in the limit
of no information extracted from the shape of the radial suppression.
Specifically, for this calculation we do not differentiate the
photometric suppression
term $e^{-c^2 \sigma_z^2 k_\parallel^2 / H^2}$ with respect to $H$
in stage I, and the parameters
$\ln \sigma_z$ are removed.  In other words, this is the calculation
in the SE03 limit as discussed earlier.
Unlike in SE03 we include photometric redshift biases $\delta z$ in stage
II to explore their effect on dark energy constraints. The error
contour with $[\sigma_z, \sigma_{\rm P}(\ln \sigma_z),
\sigma_{\rm P}(\delta z)]= (0.04, 0.01, 0.01)$ (dashed line)
from Fig.~\ref{fig:lsstw0wa} is added for comparison.

One sees in Fig.~\ref{fig:selimit} that
the constraints from baryon oscillations in photometric redshift
surveys are tightened tremendously by fully utilizing our
knowledge of the photometric suppression to the galaxy power
spectrum. Without extracting information from
$e^{-c^2 \sigma_z^2 k_\parallel^2 / H^2}$,
we obtain $[\sigma(\Omega_{\rm DE}), \sigma(w_0), \sigma(w_{\rm a})]
= (0.046, 0.33, 0.77)$ for $\sigma_{\rm P}(\delta z) = 0.001$
(dotted line) and $(0.084, 0.60, 1.4)$ for
$\sigma_{\rm P}(\delta z) = 0.01$ (solid line). These constraints
are as loose as those with very weak priors on $\ln \sigma_z$ in
Figs.~\ref{fig:contw0} and \ref{fig:contwa}. They do not improve for
$\sigma_{\rm P}(\delta z) \lesssim 0.001$ or degrade much for
$\sigma_{\rm P}(\delta z) \gtrsim 0.008$.

\section{Discussion and Conclusions} \label{sec:dis}

The statistical properties of weak lensing maps are sensitive
to the distances to the sources, and not to the redshifts of
the sources. Therefore, even without redshift information,
weak lensing observations can be used to determine the source
distance distribution.  The redshift information is needed
only so the source distance distribution can inform us about
the distance-redshift relation.  However, this distance-redshift
relation is exactly what we want, because of its sensitivity
to dark energy, and therefore the redshift information is actually
terribly important.

We have pointed out that the three-dimensional power spectra
of the source galaxies, because of their sensitivity to redshift
errors, can be used to inform us about the source redshift
distribution.  While the galaxy power spectra, on their own,
cannot give us all we need to know for interpretation of
tomographic cosmic shear data, they can be used to {\em supplement}
the redshift information available from external calibration of the
photometric redshifts.

We have demonstrated the supplemental information available
in two different ways.  First, if one uses prior information
(perhaps from external calibration)
about the variance of the redshift errors
in each of the redshift bins, then the mean redshifts of
each of those redshift bins can be recovered.  They
can be recovered with sufficient precision to greatly limit
the degradation in the errors on dark energy EOS parameters
reconstructed from cosmic shear data.  Second, without
any prior on the redshift error variance, the three-dimensional galaxy
power spectra can be used to determine very precisely the
source distance distribution which with the assumption of
a normal distribution is specified by the combination $\sigma_z/H$.
The source distance distribution
will be very helpful for interpretation of cosmic shear data.
Although, for determining the distance-redshift relation (and
thereby the dark energy EOS parameters) we will still
require mean redshifts for each of the redshift bins, in this
case from some external calibration.

The galaxy power spectra, combined with external calibration
of the source redshift distributions, are also potentially powerful
probes of dark energy.
{\em If} the rms photometric redshift error is determined to better
than $1\%$ through some external calibration
of an unbiased subsample, and one can
control sub redshift bin bias evolution then
one can significantly reduce errors on the Hubble parameter and,
consequently, put tight constraints on the dark energy EOS
parameters using baryon acoustic oscillations. For instance, with
priors $\sigma_{\rm P}(\ln \sigma_z) = 0.005$ and
$\sigma_{\rm P}(\delta z) \lesssim 0.004$, one can achieve
$\sigma(\Omega_{\rm DE}) = 0.015$, $\sigma(w_0) = 0.095$, and
$\sigma(w_{\rm a}) = 0.24$ with LSST.

Achieving, in practice, the constraints on dark energy from baryon
oscillations
and cosmic shear, that are possible in principle, will require very
accurate calibrations of photometric redshifts for very faint galaxies.
This is a significant challenge for the observational community.  The
consistency tests we have described here may play an important role in
meeting that challenge.

\acknowledgements
We thank Y.~S. Song for providing the CMB Fisher matrix.
We thank D. Eisenstein, Z. Ma, N. Padmanabhan, and J.~A. Tyson for
useful conversations and McGill
University for their hospitality while some of this work was completed.
This work was supported by the National Science Foundation under
Grant No. 0307961 and NASA under grant No. NAG5-11098.


\section{}

The recent discovery that the expansion of the universe is
accelerated, obtained by studying type Ia supernovae \cite{SN},
and the cosmic microwave background experiments showing that the
universe has nearly critical density \cite{CMB},
call for a theoretical explanation. Two classes of models are
predominant in the literature: the first class assumes that
there
is a form of {\em dark energy} (or {\em quintessence})
unclustered at all scales, that accounts for 70\% of the energy
density $\rho$ of the universe. This dark energy, of unknown
nature, is necessarily exotic: to generate acceleration in
Einstein gravity it must have  negative pressure
$P_{DE}<-\rho_{DE}/3$. The best fit to the observational data
favours an even more exotic dark energy ({\em phantom energy} or
{\em superquintessence}) with equation of state parameter $
w\equiv P_{DE}/\rho_{DE}<-1$, which is evolving in
time \cite{w}. Were a value $w<-1$ to be confirmed by
observations, it
can not be explained by general relativity with a canonical
scalar field $\phi$, which is the most common model of dark
energy, because of the Einstein--Friedmann equation
$\dot{H}=-\kappa\left( P_{\phi}+\rho_{\phi}
\right)/6=-\kappa\dot{\phi}^2/2 \leq 0$, which is incompatible
with $P_{\phi}<-\rho_{\phi} $ (equivalent to {\em
superacceleration} $\dot{H}>0$). To
model an equation of state parameter $w<-1$, a phantom field
\cite{phantom} or
a field coupled nonminimally to
the Ricci curvature $R$ (see Refs.~\cite{mybook,NMC} for reviews)
have been considered. These theories can
be seen as special cases of scalar--tensor gravity, described by
the action \cite{ST}
\begin{equation} \label{1}
S=\int d^4 x \sqrt{-g}\left[ \psi(\phi)R-\frac{1}{2}
\nabla^c\phi\nabla_c\phi-V(\phi) \right] \;.
\end{equation}

The second class of models does not require the presence of
exotic dark energy but modifies gravity at large scales by
introducing non--linear (in $R$) corrections to the
Einstein--Hilbert Lagrangian which become dominant only at late
times (low curvatures) \cite{MG1}--\cite{MG3}. These theories
often suffer from problems with the post--Newtonian limit
\cite{ChibaPLB03,DolgovKawasaki03,PPN} or from instabilities
\cite{instabilities}, and
are not
yet accepted as completely viable theories, but they are
nevertheless interesting as the cosmic acceleration that we are
observing may be the first sign of a departure from Einstein's
gravity. Furthermore, these models are motivated by certain
compactifications of M--theory \cite{Mtheory}.

In both dark energy models and modified gravity, depending on the
model adopted, the universe may
accelerate forever or end its existence at a  finite time in the
future in a Big Rip or sudden future singularity
\cite{BigRip,myBigRip,footnote1}. Such singularities have been
classified
in Ref.~\cite{NO2}; according to this classification, it is known
that singularities of type~I can occur in these
models \cite{myBigRip}, but singularities of other types are not
excluded.

The fate of the universe depends on
the presence and size of the attraction basins of attractor
solutions in the phase space. In many models of both dark energy
and modified gravity, a de Sitter attractor solution is found
\cite{deSitterattractors}.
In this paper we address the issue of the stability of de
Sitter
space in modified gravity and scalar--tensor theories.
It is
straightforward to  assess stability with respect to homogeneous
(time--dependent only) perturbations; however, it is more
significant to establish whether de Sitter space is also stable
with
respect to more  general inhomogeneous (space-- and
time--dependent) perturbations. This is a much more difficult
task because of the gauge--dependence problems associated with
this kind of perturbations \cite{Bardeen}. In the following we
show that for
modified gravity the stability condition obtained with a
gauge--independent inhomogeneous perturbation analysis reduces
to that obtained in the much simpler homogeneous perturbation
analysis, whereas this is not the case for scalar--tensor
gravity.

We begin from the generalized gravity action
\begin{equation} \label{2}
S=\int d^4x \, \sqrt{-g} \left[ \frac{f \left( \phi, R
 \right)}{2}\, -\frac{\omega( \phi)}{2}\,
\nabla^c\phi\nabla_c\phi
-V(\phi) \right] \;,
\end{equation}
which contains scalar--tensor gravity as the case $f\left(
\phi, R \right)=\psi(\phi) R $, and modified gravity $f(R)$ when
the scalar  field $\phi$ is absent and $f_{RR} \neq 0$. In the
spatially
flat Friedmann--Lemaitre--Robertson--Walker (FLRW) metric
\begin{equation} \label{3}
ds^2=-dt^2+a^2(t) \left( dx^2+dy^2+dz^2 \right) \;,
\end{equation}
the field equations are
\begin{eqnarray}
&& H^2  =  \frac{1}{3F} \left( \frac{\omega}{2} \, \dot{\phi}^2
+\frac{RF}{2} -\frac{f}{2} +V  -3H\dot{F}
\right)   \;, \label{4} \\
&& \nonumber \\
&& \dot{H} =   - \, \frac{1}{2F}  \left( \omega \dot{\phi}^2
+ \ddot{F}  -H\dot{F} \right)  \;, \label{5} \\
&& \nonumber \\
&&
\ddot{\phi } +3 H \dot{\phi} +\frac{1}{2\omega} \left(
\frac{d\omega}{d\phi} \,  \dot{\phi}^2 - \frac{\partial
f}{\partial \phi} +2\, \frac{dV}{d\phi}
\right) =0 \;,\label{6}
\end{eqnarray}
where $F\equiv \partial f/\partial R$, $H\equiv \dot{a}/a$,
and an overdot denotes differentiation with respect to
the comoving time $t$. By choosing $\left( H, \phi \right) $ as
dynamical variables, the equilibrium points of the dynamical
system (\ref{4})--(\ref{6}) are de Sitter spaces with constant
scalar field $\left( H_0, \phi_0 \right) $. These solutions
exist subject to the conditions
\begin{eqnarray} \label{7}
&& 6H_0^2 \, F_0 - f_0+2V_0 =0 \;, \\
&&\nonumber \\
&& {f_0}'- 2{V_0}' =0 \;, \label{8}
\end{eqnarray}
where $
F_0 \equiv F \left( \phi_0, R_0 \right) $, $ f_0\equiv f
\left( \phi_0, R_0 \right) $, $ V_0 \equiv  V  \left( \phi_0
\right) $, $ {V_0}' \equiv  \left. \frac{dV}{d\phi}
\right|_{ \phi_0 } $, a prime denotes differentiation with
respect to $\phi$, and $ R_0 = 12 H_0^2 $.

Inhomogeneous perturbations of de Sitter space are investigated
by using the covariant and gauge--invariant formalism of
Bardeen--Ellis--Bruni--Hwang \cite{Bardeen} in the version
studied by Hwang \cite{Hwang} for generalized gravity. The
metric  perturbations are defined by
\begin{eqnarray}
g_{00} & = & -a^2 \left( 1+2AY \right) \;, \label{9} \\
&& \nonumber \\
g_{0i} & = & -a^2 \, B \, Y_i  \;, \label{10} \\
&& \nonumber \\
g_{ij} & =& a^2 \left[ h_{ij}\left(  1+2H_L  \right) +2H_T \,
Y_{ij}  \right] \;,\label{11}
\end{eqnarray}
where the scalar harmonics $Y$ are the eigenfunctions of the
eigenvalue problem $
\bar{\nabla_i}\bar{\nabla^i} \, Y =-k^2 \, Y $.
Here $h_{ij} $  is the three-dimensional metric of the FLRW
background and the operator $ \bar{\nabla_i}
$ is the covariant derivative associated with  $h_{ij}$, while
$k$ is an eigenvalue. The vector and tensor
harmonics $Y_i$ and $Y_{ij}$ obey
\begin{equation} \label{13}
Y_i= -\frac{1}{k} \, \bar{\nabla_i} Y \;, \;\;\;\;\;\;
Y_{ij}= \frac{1}{k^2} \, \bar{\nabla_i}\bar{\nabla_j} Y
+\frac{1}{3} \, Y \, h_{ij} \;.
\end{equation}
Bardeen's gauge--invariant potentials
\begin{eqnarray}
&& \Phi_H = H_L +\frac{H_T}{3} +\frac{ \dot{a} }{k} \left(
B-\frac{a}{k} \, \dot{H}_T \right) \;, \label{15} \\
&& \nonumber \\
&& \Phi_A = A  +\frac{ \dot{a} }{k} \left( B-\frac{a}{k} \,
\dot{H}_T \right)
+ \frac{a}{k} \left[ \dot{B} -\frac{1}{k} \left( a \dot{H}_T
\right)\dot{}  \right] \;,  \label{16}
\end{eqnarray}
and the Ellis--Bruni variable
\begin{equation} \label{17}
 \Delta \phi = \delta \phi  +\frac{a}{k} \, \dot{\phi}  \left(
B-\frac{a}{k} \, \dot{H}_T
\right) \;.
\end{equation}
are used, with equations similar to eq.~(\ref{17}) defining the
gauge--invariant variables $ \Delta f$, $\Delta F $,  and
$\Delta R$.  The first order equations obeyed by the
gauge--invariant perturbations are given in Ref.~\cite{Hwang}
and they simplify considerably in the de Sitter background
$\left(H_0,\phi_0 \right)$. To first order, they are:
\begin{widetext}
\begin{equation}  \label{42}
\Delta \ddot{\phi} + 3H_0  \Delta \dot{\phi}
+ \left[ \frac{k^2}{a^2}-\,  \frac{1}{2\omega_0} \left( f_0''   - 2 V_0'' \right) \right]
\Delta \phi  =
 \frac{ f_{\phi R}}{2 \omega_0 } \,  \Delta R  \; ,
\end{equation}

\begin{equation}  \label{43}
\Delta \ddot{F} +3H_0 \, \Delta \dot{F} +\left( \frac{k^2}{a^2} - 4H_0^2 \right) \Delta F
+\frac{F_0}{3} \, \Delta R =0 \;,
\end{equation}

\begin{equation} \label{44}
\ddot{H}_T +3H_0  \, \dot{H}_T +\frac{k^2}{a^2} \, H_T=0 \;,
\end{equation}

\begin{equation} \label{45}
-\dot{\Phi}_H+H_0 \Phi_A =\frac{1}{2} \left( \frac{\Delta \dot{F}}{F_0} -H_0 \, \frac{ \Delta
F}{F_0}
\right) \;,
\end{equation}

\begin{equation}  \label{46}
\Phi_H  = -  \frac{1}{2} \, \frac{ \Delta F}{F_0}   \; ,
\end{equation}

\begin{equation}   \label{47}
\Phi_A + \Phi_H =  - \frac{\Delta F }{F_0} \; ,
\end{equation}

\begin{equation}  \label{48}
\ddot{\Phi}_H + 3H_0 \dot{\Phi}_H  - H_0  \dot{\Phi}_A -3H_0^2 \Phi_A
 =  - \frac{1}{2}\frac{  \Delta \ddot{F}}{F_0} - H_0 \, \frac{\Delta \dot{F}}{F_0}
+ \frac{3H_0^2 }{2} \, \frac{\Delta F}{ F_0 }   \; ,
\end{equation}
with
\begin{equation} \label{49}
\Delta R=6 \left[ \ddot{\Phi}_H + 4H_0 \dot{\Phi}_H +
\frac{2}{3} \frac{k^2}{a^2} \, \Phi_H
 -H_0 \dot{\Phi}_A + \left( \frac{k^2}{3a^2} -4H_0^2 \right)
\Phi_A \right] \;,
\end{equation}
\end{widetext}

Furthermore, vector perturbations do not
have any effect to first order in the absence of ordinary matter
\cite{Hwang} and de Sitter space is always stable with respect
to first order tensor perturbations, as can be seen from
eq.~(\ref{44}), so we only need
to worry about scalar perturbations (see Ref.~\cite{deSitter}
for details). We first consider modified gravity theories
obtained by
setting $\phi \equiv 1$ and $f=f(R)$ with $f_{RR}\neq 0 $ in
the action (\ref{2}). The gauge--invariant perturbations are
related by  \cite{deSitter}
\begin{eqnarray}
\Phi_H & = & \Phi_A =-\, \frac{\Delta F}{2F_0}  \label{18} \;,\\
&&\nonumber \\
\Delta R & = & 6 \left[ \ddot{\Phi}_H + 3H_0 \dot{\Phi}_H  +
\left( \frac{k^2}{a^2}  -4H_0^2 \right) \Phi_H
 \right] \;, \label{19}
\end{eqnarray}
where $a=a_0 \mbox{e}^{H_0 t}$. By using the fact that
$ \frac{\Delta F}{F_0}=\frac{f_{RR}}{F_0}\, \Delta R$, one
obtains $\Delta R=-\frac{2F_0}{f_{RR}}\, \Phi_H $. The
perturbations $\Phi_H$ and $ \Phi_A$ evolve according to
\begin{equation} \label{20}
\ddot{\Phi}_H+3H_0 \dot{\Phi}_H+\left(
\frac{k^2}{a^2}-4H_0^2 +\frac{F_0}{3f_{RR}}\right) \Phi_H=0 \;;
\end{equation}
at late times the term $k^2/a^2$ can be safely neglected and
stability  is achieved if the coefficient of $\Phi_H$ in the
last term of the left hand side of eq.~(\ref{20}) is
non--negative, i.e. (using eq.~(\ref{7})), if
\begin{equation}\label{200}
\frac{ F_0^2-2f_0 f_{RR}}{F_0 f_{RR}}\geq 0 \;.
\end{equation}
The spatial dependence of the inhomogeneous perturbations is
encoded in the eigenvector $k$ of the spherical harmonics; the
fact that the only term containing $k$ (or the physical wave
vector $k_{phys}=k/a$) in eq.~(\ref{20})
becomes negligible on a de Sitter background implies that
the spatial dependence effectively disappears from the analysis.
Eq.~(\ref{200}) coincides with the stability condition that can
be obtained by a straightforward homogeneous perturbation
analysis of eqs.~(\ref{4}) and (\ref{5}). Hence, in the
stability analysis of de Sitter space in modified gravity
theories one can safely neglect inhomogeneous perturbations and
limit oneself to the much more approachable homogeneous
perturbations, thus bypassing the gauge--dependence problems.
However, this conclusion could not be drawn {\em a
priori} but it necessarily relies
on the inhomogeneous perturbation analysis presented. Further,
this result has been shown to be true only for the stability of
de Sitter space and not for different attractor solutions that
may be present in the phase space.

Naively, the physical reason for this considerable formal
simplification
could be looked for in the fact that, during the
quasi--exponential expansion of the universe, inhomogeneities
(and anisotropies \cite{Waldtheorem}) are redshifted away; this
is not the whole story though, because the simplification found
for modified gravity does not occur in scalar--tensor theories.
In fact, in this case, eqs.~(\ref{44}), (\ref{18}), and
(\ref{19}), together with
\begin{equation}
\frac{\Delta F}{F_0}=\frac{f_{\phi R}}{F_0}\, \Delta R \;,
\end{equation}
yield
\begin{equation} \label{89}
\Delta \ddot{\phi} + 3H_0 \, \Delta \dot{\phi}
+ \left[  \frac{k^2}{a^2}-\,  \frac{  \left( \frac{f_0''}{2}   -
V_0'' +\frac{6 f_{\phi R}^2}{F_0} \,
H_0^2 \right)}{\omega_0  \, \left( 1+\frac{ 3f_{\phi
R}^2}{2\omega_0 F_0} \right)}   \right]
\Delta \phi  = 0
\end{equation}
if $ 1+3f_{\phi R}^2/( 2 \omega_0 F_0) \neq 0$.  The
stability condition of de Sitter space in scalar--tensor
gravity then becomes \cite{deSitter}
\begin{equation}\label{100}
\frac{  \left( \frac{f_0''}{2}   -   V_0'' +\frac{6 f_{\phi
R}^2}{F_0} \, H_0^2 \right)}{\omega_0 \, \left( 1+\frac{
3f_{\phi R}^2}{2\omega_0 F_0} \right)} \leq 0 \;.
\end{equation}
For general scalar--tensor theories, this condition is more
restrictive than the corresponding stability condition obtained
from a straightforward homogeneous perturbation analysis of
eqs.~(\ref{4})--(\ref{6}), which is
\begin{equation}  \label{101}
\frac{ \frac{f_0''}{2}   -   V_0''}{ \omega_0}  \leq 0 \;.
\end{equation}
However, for scalar--tensor theories of the form
\begin{equation}
S=\int d^4x \, \sqrt{-g} \left[ \phi R
-\frac{\omega(\phi)}{\phi} \nabla^c\phi\nabla_c \phi -V(\phi)
\right]
\end{equation}
with a single coupling function, eqs.~(\ref{100}) and
(\ref{101}) coincide \cite{Mike}. The reason for the failure of
these
equations to coincide in the general case can be traced to the
right hand side of eq.~(\ref{42}), in which perturbations
$\Delta R$ act as a source for the perturbation $\Delta \phi$
(roughly speaking, perturbations $\delta H$ in the Hubble
parameter, and their derivatives, source scalar field
perturbations $\delta \phi$): such a term is absent in the
homogeneous perturbation analysis of the Klein--Gordon equation
(\ref{6}).
Analogously, such a term is absent in eq.~(\ref{20}) obeyed by
the gauge--independent perturbations $\Phi_H $ (or $\Phi_A$) in
modified gravity. This shows that although modified gravity is
mathematically equivalent to a scalar--tensor theory
\cite{TeyssandierTourrenc,ChibaPLB03}, the corresponding
physics is not completely equivalent.

As an example of application of the stability condition
(\ref{200}), let us consider the theory described by
\cite{oneoverR,ChibaPLB03,MG3}
\begin{equation}
f(R)=R-\, \frac{\mu^4}{R} \;.
\end{equation}
The de Sitter space must satisfy the condition
$R_0=12H_0^2=\sqrt{3}\, \mu^2$ and the stability condition
(\ref{200}) can never be satisfied: this de Sitter space is
always unstable. This situation can be ameliorated by a quadratic
correction -- in the theory with
\begin{equation} \label{last}
f(R)=R-\, \frac{\mu^4}{R} +aR^2 \;,
\end{equation}
the condition for the existence of de Sitter space is again
$R_0=\sqrt{3}\, \mu^2$; by applying the stability condition
(\ref{200}) one obtains that de Sitter space is stable if
\begin{equation}
a> \frac{1}{ 3\sqrt{3} \, \mu^2}
\end{equation}
and unstable otherwise (in particular for negative $a$).
This result agrees with those of Refs.~\cite{NO1}, which follow
from an independent analysis of the effective potential in the
Einstein
conformal frame version of the scalar--tensor theory equivalent
to the action~(\ref{2}) with $f(R)$ specified by
eq.~(\ref{last}). Furthermore, the theory described by
corrections in both $1/R$ and $R^2$ has much better chances of
passing the Solar System tests than the theory based on simple
$1/R $ corrections \cite{NO1}.

A more
complete discussion of the relation between stability
of modified gravity and of scalar--tensor theories, and the
application of eqs.~(\ref{200}) and (\ref{100}) to other specific
dark  energy and modified gravity  scenarios will be presented
elsewhere.

\begin{acknowledgments}
This work was supported by the Natural Sciences and Engineering
Research Council of Canada ({\em NSERC}) and by a grant
from the Senate Research Committee of Bishop's University.
\end{acknowledgments}