finding maximum virtual and physical memory If the following is given:


CPU uses a four-level hierarchical page table, each level can contain 512 entries
the page size is 4KB.
virtual address is 48 bits   


How do i get the size of the virtual memory (in terms of pages or bytes). Do i just use the number of page table entries 29*4+12 ?

And can i get the size of the physical memory given this information ?
No, you can't get size of physical memory with the provided information.

Explanation:


Virtual memory that you mentioned is correct. But you can calculate
it just by seeing the number of bits virtual address has (What you
did is correct though).
To calculate the physical memory, we need to know that Physical memory is a collection of frames, which has same size as pages. Since
Page size is already given (4KB), next we need to know how many
frames does main memory(physical) has. For this we need to know the
size of page table entry, which contains frame address. If we know frame
address length, then we can calculate the total number of frames by
calculating  2^(length of frame address). 
Then you can multiply the frame size (4KB) with the above value to get the size of Physical memory.