PRICING SUPPLEMENT NO.  40                                        Rule 424(b)(3)
DATED:  October 17, 2002                                      File No. 333-76894
(To Prospectus dated January 25, 2002,
and Prospectus Supplement dated January 25, 2002)

                                 $10,006,693,162
                         THE BEAR STEARNS COMPANIES INC.
                           MEDIUM-TERM NOTES, SERIES B

Principal Amount: $229,400,000   Floating Rate Notes [x]  Book Entry Notes [x]

Original Issue Date: 10/22/2002  Fixed Rate Notes [ ]     Certificated Notes [ ]

Maturity Date: 10/22/2004        CUSIP#: 073928XW8

Option to Extend Maturity:       No    [x]
                                 Yes   [ ]  Final Maturity Date:


                                              Optional            Optional
                         Redemption           Repayment           Repayment
   Redeemable On          Price(s)             Date(s)            Price(s)
   -------------       --------------       -------------        -----------

        N/A                  N/A                 N/A                 N/A

Applicable Only to Fixed Rate Notes:
------------------------------------

Interest Rate:

Interest Payment Dates:

Applicable Only to Floating Rate Notes:
---------------------------------------

Interest Rate Basis:                     Maximum Interest Rate:  N/A

[ ]   Commercial Paper Rate              Minimum Interest Rate:  N/A

[ ]   Federal Funds Effective Rate

[ ]   Federal Funds Open Rate            Interest Reset Date(s):  *

[ ]   Treasury Rate                      Interest Reset Period:  Quarterly

[ ]   LIBOR Reuters                      Interest Payment Date(s):  **

[x]   LIBOR Telerate

[ ]   Prime Rate

[ ]   CMT Rate

Initial Interest Rate: 2.27875           Interest Payment Period:  Quarterly

Index Maturity:  Three Months

Spread (plus or minus):  +0.45%

*     On the 22nd of each January, April, July and October prior to Maturity.

**    On the 22nd of each January, April, July and October, including the
      maturity date.

The distribution of Notes will conform to the requirements set forth in Rule
2720 of the NASD Conduct Rules.