Melody R. answered 07/31/19
Reading & Language Arts Teacher-19 years experience; remote homeschool
Your second sentence is not grammatically correct. "The little girl was hiding back of the tree," is not something that can be said. "in the back of" something means in the rear position as in, "He sat in the back of the bus." "Back" with any preposition shows a specific position at the farthest end as in, "I was at the back of the line." The sentence, "The little girl was hiding behind the tree," would be the most grammatically correct, as her position is behind the tree, and not at the end or the rear of something. These phrases are not interchangeable. Behind means that the view is obstructed by something in a more forward position.
When grammatically correct, these phrases are absolutely correct in formal writing because they cannot be said in any other way. Prepositions are very important here.
Other examples of each of these are:
The milk in the back of the fridge expired. (I didn't know it was back there and it has soured)
The boy in the back of the line kicked the girl in front of him. (the boy is in the last position in line)
The milk in the fridge was behind the juice. (explaining why I didn't see it)
The little boy hid behind the teacher when the little girl yelled at him.
Here is the correct useage for "back" without a preposition:
I met him back at our house. (I returned there)
He gave me back my book. (also to return it to me)