  Cognitive radio has been proposed to alleviate the scarcity of available
spectrum caused by the significant demand for wideband services and the
fragmentation of spectrum resources. However, sensing performance is quite poor
due to the low sensing signal-to-noise ratio, especially in complex
environments with severe channel fading. Fortunately, reconfigurable
intelligent surface (RIS)-aided spectrum sensing can effectively tackle the
above challenge due to its high array gain. Nevertheless, the traditional
passive RIS may suffer from the ``double fading'' effect, which severely limits
the performance of passive RIS-aided spectrum sensing. Thus, a crucial
challenge is how to fully exploit the potential advantages of the RIS and
further improve the sensing performance. To this end, we introduce the active
RIS into spectrum sensing and respectively formulate two optimization problems
for the passive RIS and the active RIS to maximize the detection probability.
In light of the intractability of the formulated problems, we develop a
one-stage optimization algorithm with inner approximation and a two-stage
optimization algorithm with a bisection method to obtain sub-optimal solutions,
and apply the Rayleigh quotient to obtain the upper and lower bounds of the
detection probability. Furthermore, in order to gain more insight into the
impact of the RIS on spectrum sensing, we respectively investigate the number
configuration for passive RIS and active RIS and analyze how many reflecting
elements are needed to achieve the detection probability close to 1. Simulation
results verify that the proposed algorithms outperform existing algorithms
under the same parameter configuration, and achieve a detection probability
close to 1 with even fewer reflecting elements or antennas than existing
schemes.
