What is the part of speech in each sentence? Is my explanation right?

1. This book is for you.
['For you' is an adverb phrase.]

2. The gift for you is a book.
['For you' is an "adjective" phrase.]

3. I bought this book for you.
['For you' is an adverb phrase.]

There are eight parts of speech in English.

https://en.wikipedia.org/wiki/Part_of_speech#Western_tradition

You are referring to each prepositional phrase's usage, not the part of speech.

Sentence 1 --
This = pronoun
book = noun
is = verb
for = preposition
you = pronoun

A prepositional phrase is comprised of a preposition plus its object (which can be either a noun or a pronoun). There is often an article and/or adjective between the preposition and its object.

Please revise your original statement. You're not referring to parts of speech here, but to the use of prepositional phrases: adjectival or adverbial.

To determine the part of speech in each sentence, it is necessary to identify the words or phrases in question and analyze their role in the sentence.

1. "For you" in the sentence "This book is for you" is actually a prepositional phrase. Prepositional phrases typically consist of a preposition (in this case, "for") followed by an object (in this case, "you"). Prepositional phrases function as adverbs, adjectives, or nouns by providing information about time, location, manner, etc. In this sentence, the prepositional phrase "for you" is acting as an adverbial phrase, indicating who the book is intended for.

2. In the sentence "The gift for you is a book," the phrase "for you" is still a prepositional phrase. However, it is functioning as an adjective, as it modifies the noun "gift." Adjective phrases modify or describe nouns or pronouns in a sentence.

3. "For you" in the sentence "I bought this book for you" is once again a prepositional phrase acting as an adverbial phrase. It specifies the purpose or recipient of the book.

So, to summarize, in sentence 1, "for you" is a prepositional phrase functioning as an adverbial phrase. In sentence 2, "for you" is a prepositional phrase functioning as an adjective phrase. In sentence 3, "for you" is a prepositional phrase functioning as an adverbial phrase.