The Japanese writing system is an interesting mixture of innovation and tradition. It combines a set of Chinese logograms and two Chinese-derived syllabaries into a complex logosyllabic system.
Writing came to Japan from China during the 5th century CE. The first Japanese texts were written in Chinese characters (kanji), a system called kanbun (which simply means "Chinese Writing"). However, writing in Chinese became very awkward as the grammatical syntax of the Japanese language is considerably different from Chinese. The solution to this problem is to keep the Chinese characters but use Japanese grammar.
The next problem is that Chinese is an isolating language, which led to a writing system where each sign represented a morpheme. The Japanese language, on the other hand, has inflected verbs and postpositions, requiring concatenation of suffixes and particles to words and clauses in a sentence. So, in order to represent these extra grammatical units, the Japanese scribes used certain Chinese characters for their sound values. This means that the system was ambiguous, as it was hard to tell whether a character was to be interpreted as a logogram or a phonetic sign.
This ambiguous system eventually led to a change in the graphical representation of the syllabograms. The Chinese characters used to write out sounds were visually simplified and made distinct from the Chinese characters used as logograms.
The Two Kana Systems
A syllabic grapheme in the Japanese writing system is called a kana. There are two sets of kanas, namely, hiragana, and katakana.
In modern times, hiragana is used to write native Japanese words. Its origin lies in the early literary works which used Chinese characters completely for their phonetic values at the 8th century CE. This system is called the manyogana, from the anthological work "Manyoshu". Eventually the signs were reduced in number and simplified into sogana, and then finally into hiragana.
At first, hiragana was scorned by literate men as Chinese was the "cultured" language. Women, on the other hand, use hiragana primarily since they were not allowed to learn the Chinese characters. This culminated in the Tale of Genji, the world's first novel written by Lady Murasaki Shikibu during the Heian era (795-1192). However, this gender-based segregation of literacy eventually dissolved and hiragana was became an accepted literary script.
The following is the hiragana syllabary:
The second Japanese syllabary is called katakana, which has its origin as a pronunciation aid for Chinese Buddhist scriptures. Over time it came to be used to write grammatical suffixes, particles and postpositions, while kanji remained the original form, or root, of the word. In modern times, katakana has come to be used to write non-Chinese loan words.
Some special syllabograms in both hiragana and katakana reflect allophones in the Japanese language. Allophones are different physical sounds that are perceived as the same sound by speakers of a language. Typically the position of a kana in the grid determines its pronunciation, but these special signs are pronounced differently. For instance, the hiragana sign し is located in the s column and i row, which means it should have the phonetic value of /si/. But instead it is pronounced as /ši/ (like English she) due to linguistic change. As a result, /s/ and /š/ are allophones before the vowel /i/ and perceived as the same consonant in Japanese.
The following are the allophones in Japanese.
In additional to the basic signs, several diacritic marks are used to change the quality of the consonants. Two diagonal dashes placed on the upper right corner of a sign starting with /k/, /s/, or /t/ turns the voiceless consonant into a voiced one. Note that I'm using hiragana for all examples, but the same rules apply to katakana as well.
A special case occurs with the /h/ series, which serves as the basis of bilabial consonants /b/ and /p/. A small circle on the upper right turns the consonant to /p/, where as the double-diagonal-dash mark changes the consonant to /b/. Historically speaking, the /h/ sound in modern Japanese corresponds to the bilabial fricative sound /f/ or /Φ/ in Old Japanese (and still preserved in modern ふ /fu/) which is why the /h/ series came to be the basic signs for bilabial signs.
Another feature of the Japanese language is patalization, which is changing the quality of a consonant to have a /y/-like quality. To write palatalized sounds like /kyo/ in Kyoto, the convention is to use the -i sign with the desired consonant, followed by a sign from the /y/ series. The /y/ sign is written in a smaller size to distinguish it from a fully syllabic sign. When the /y/ sign follows the syllabogram し /ši/, ち /či/, or じ /ji/, then the patalization is dropped and a simple syllable with the regular consonant and a vowel is represented.
It is possible to have a double consonant in Japanese, like /kk/, /ss/, /tt/, and /pp/. The first of the double consonant is always represented using a smaller /tsu/ sign.
And finally, Japanese also has long vowels, such as /aa/, /ee/, /ii/, /oo/, /uu/. The way they are written in hiragana is actually different from the way in katakana. In hiragana, long vowels is indicated by using the syllabogram with the matching vowel from the vowel-only series. So /yuu/ is be written as /yu/ followed by /u/. On the other hand, in katakana, a horizontal line is used for all vowels to mark that it's long.
Chinese Characters: Kanji
In addition to the kanas, modern Japanese writing contains about a thousand Chinese characters, or kanji, to write words (both native Japanese and Chinese loans). Often times, Japanese names (personal, geographical, etc) are written completely in kanji. For example, Tokyo is always written as , instead of . Also, some words (both Japanese and Chinese loans) would be written as kanji as well.
In the following example, "gakusei" is kanji, while everything else is hiragana. Also note that the particle /wa/ is written with the syllabogram /ha/. This is due to historical reasons and one of the few irregular forms in the writing system.
If you pick up a Japanese newspaper, you'll probably see all three writing systems represented.