Ninth chords are created by adding the first scale-extension to an existing
7th chord, and modifying it to match the chord's function and style.
Intervallically this note is a compound-second, and is the fifth odd-numbered note encountered when skipping through a scale in thirds (the first beyond the octave).

ninth chords [ Cmaj7(9) as example ]

scale degree

degree name

solfege syllable

note in C major

octave----

9

ninth

re

D

7

seventh

ti

B

5

fifth

sol

G

3

third

mi

E

1

root

do

C

Three variations of ninths are available, and most seventh-chords support one or more of these variations, depending on its function.
The ninth that occurs naturally in the major scale (equivalent to the second scale-degree) is the natural-nine.
The equivalent note will be a whole-step above the first scale-degree, which is the root of the scale and the chord.

The variations are a half-step above (#) or below (b) the natural-nine.
For the example above, the sharp-nine would be D sharp (D#) and the flat-nine would be D flat (Db).
Each chord has a standard expectation of which ninths are matched to it, and in what function or use these ninths relate to.
These are refered to as allowable ninths.

seventh chord

allowable ninth[s]

comments

C(maj7)

natural-nine (9)

#9 used for endings

C7

flat-nine (b9), natural-nine (9), sharp-nine (#9)

b9 and #9 go together and suggest a minor targetnatural-nine suggests major

Cm7

natural-nine (9)

b9 is sometimes found on III-7

Cm7(b5)

flat-nine (b9), natural-nine (9)

typical use for natural-nine is VI-7(b5) in minor

C°7

natural-nine (9)

9 not always available depending on function

C7(sus4)

flat-nine (b9), natural-nine (9), sharp-nine (#9)

b9 and #9 go together and suggest a minor targetnatural-nine suggests major

Cmaj7(#5)

natural-nine (9)

standard jazz comping-voicing does not include 9th

Cmaj7(b5)

natural-nine (9)

standard jazz comping-voicing does not include 9th

Cm(maj7)

natural-nine (9)

no comment

C7(#5)

flat-nine (b9), natural-nine (9), sharp-nine (#9)

b9 and #9 go together and suggest a minor targetnatural-nine suggests major

C7(b5)

flat-nine (b9), natural-nine (9), sharp-nine (#9)

b9 and #9 go together and suggest a minor targetnatural-nine suggests major