what is the purpose of man?

Christian Doctrine    The Purpose of Man is to Glorify God!      

Mankind was created to bring Glory to God.

"Everyone who is called by my name, whom I created for my glory, whom I formed and made." Isaiah 43:7

God the Creator, creates to bring himself 'Glory'.  To us, this may seem arrogant.  It might appear that God, just to have Himself hear praise for all eternity, chose to make man to accomplish this task.  But this is clearly a distorted view of the purpose of the Glory of God.  We see these things with the burden of our sinful nature attached - and indeed, if any one of us required 'praising', we would be deemed arrogant, because we would be placing ourselves in a 'higher state' than others.  But God by definition IS in this 'higher state'.  His nature as God deserves and earns this gratitude and praise!  But, nevertheless, this is the whole purpose of man, in our accomplishment of the Glorifying of God.

God is Love, by nature.  The greatest expression of love comes by giving.  God created mankind in order to give His nature to him.  Aside from the gift of His Son, Jesus, giving His likeness to mankind is His greatest gift.

Then God said, "Let us make man in our image, in our likeness"...So God created man in His own image, in the image of God He created him; male and female He created them.  Genesis 1:26a, 27

Did God create to have companionship?  Yes He did, but not for the reason commonly thought.  God is not lonely without mankind, because He is in an eternal relationship within the Trinity.  He did not need mankind in order to fulfill Himself or any need, because He is by definition 'needless'.  He created because that is what a Creator does, and He created man so that He could express His Loving nature by giving:

So God created because it is in His nature to create, and because He is Love.  He gives because He loves.  And because He has life, He loves to give life.  Christianity 101; Gilbert Bilezikian; pg 35

So by definition, our existence glorifies (gives credit to, appreciates, and acknowledges) the Creator.   We are the result of His love, and a representation, though fallen, of His nature.