I want to start investing in the stock market (I am 26) and I am a bit confused about the advantages of index funds (I am sorry if my questions are very basics, but I just started learning about this).
As far as I understand, index funds allow you to invest in many companies at once. This has the advantage that, assuming that many of them have (almost) an independent behavior the overall variance is reduced (the more companies the smaller the variance) so you are pretty guaranteed to gain money, given that the market is constantly increasing.
However, from what I've seen (and here I looked only into the USA market), the average growth of these index funds is about 5%-10% per year. On the other side, there are some companies (e.g. Apple, Amazon, Microsoft, Netflix) which had a much higher yearly return.
So my question is: why shouldn't I invest my money in 10-20 companies with a big, constant growth over the past, say, 5 years, instead of investing in an index fund?
Of course the risk of losing my money here is bigger, but given the constant growth over the past years, and the fact that these are well known companies, which (based on my small amount of readings) are expected to keep growing, is that risk, in practice, actually overcoming the possible gains?
Moreover, if something happens and these stocks stop being productive, I imagine that won't happen over night, and once that trend is apparent I can take my money out and reinvest them in other stocks. And given the current growth of these stocks, even accounting for the taxes I would need to pay on the profits when selling, the return would be significantly bigger than just investing in index funds.
I obviously didn't do the math of what I said or any form of risk analysis, so I was wondering if someone with more experience can tell me if index funds would be better than a less varied (so more risky in theory) but much better paying portfolio.