If you are using the Arduino Mega and you are learning the basics of the Arduino, then you are most likely following a tutorial (like my own Arduino Step by Step) that has content based on the Arduino Uno.

Don’t be confused: the Mega headers and the Uno headers are perfectly compatible. Just pretend that your Mega is an Uno. Look at the left part of the board, the part closer to the power barrel connector. That part has the exact same layout as the Uno, in terms of the headers and the pin functions.

So, pin “Digital 9” on the Mega is marked as “9” in the PWM group of pins. Look for the header strip that is at the top left of the board. On that header, the left-most pin is AREF.

Here’s how the Uno headers correspond to the Mega headers:

And here’s an example of the Mega with an Uno shield, side 1:

… and side 2: