If force is a vector, then why is pressure a scalar? By definition pressure is the perpendicular force applied to a unit area. So it has a direction which is perpendicular to the area. So it should be a vector. But I did sone googling and found out that it is a scalar quantity. So it would really be helpful if someone could show me how pressure is scalar with some mathematical derivation.
 A: Pressure is a scalar because it does not behave as a vector -- specifically, you can't take the "components" of pressure and take their Pythagorean sum to obtain its magnitude. Instead, pressure is actually proportional to the sum of the components, $(P_x+P_y+P_z)/3$.
The way to understand pressure is in terms of the stress tensor, and pressure is equal to the trace of the stress tensor. Once you understand this, the question becomes equivalent to questions like "why is the dot product a scalar?" (trace of the tensor product), "why is the divergence of a vector field a scalar?" (trace of the tensor derivative), etc. 
There is no physical significance to taking the diagonal components of a tensor and putting them in a vector -- there is a physical significance to adding them up, and the invariance properties of the result tells you that it is a scalar.
See also: Why do we need both dot product and cross product?
A: Pressure is proportionality factor. Area is the one that gives you direction. You have to recall that pressure is defined everywhere in the bulk volume, not just at the surface. A volume of gas has pressure defined everywhere. And the force direction is determined by you - by the way you orient your surface that you put into the gas.
$$\vec{F}=p\vec{A}$$
Here you see that the area is the vector.
Quoting wikipedia:

It is incorrect (although rather usual) to say "the pressure is
  directed in such or such direction". The pressure, as a scalar, has no
  direction. The force given by the previous relationship to the
  quantity has a direction, but the pressure does not. If we change the
  orientation of the surface element, the direction of the normal force
  changes accordingly, but the pressure remains the same.

I should clarify, that this calculates the force caused by the pressure, so it GIVES you the force perpendicular to the area, given the area vector. It's the defining equation and the only one that captures what pressure actually does, so it's always true, but needs to be understood as a formula for calculating the force from pressure.
If $\vec{F}$ is just caused by the pressure, it can't be anything else but perpendicular to the area, otherwise you have other forces present in the system, or the liquid is not isotropic. That being said, assuming that $\vec{F}$ is only caused by the pressure, you could calculate $p$ by taking absolute values:
$$p=\frac{|F|}{|A|}$$
Mathematically, you transformed a vector equation into a scalar equation assuming parallel vectors, so now you're not allowed to put in anything, but only lengths (or projections - similar argument) of F and A that are guaranteed to have been parallel, otherwise you get nonsense. You also lose the sign of pressure (for gasses, it can't happen, but for elastic solids or liquids, it can "pull" due to intermolecular forces).
However, strictly speaking, pressure is a tensor, but for gasses, it's isotropic, so it acts as a scalar. Without going into details what a tensor is, imagine above that in $p\vec{A}$, $p$ can also transform the direction, not just the magnitude of $\vec{A}$, so the force does not have to point perpendicularly. This is true in elastic solids, where you can transmit sideways forces to the surface, and in viscous flowing liquids, where the viscous force is also just a stress (generalized pressure) transmitted to the surface. In this situation, $p$ has $6$ independent components, so you cannot measure it just by measuring a force on a single surface. You'd need to measure all components of force on 3 surfaces placed in different orientations. Only in gasses, you can rely on the force having the same magnitude no matter the orientation.
Further reading:
https://en.wikipedia.org/wiki/Cauchy_stress_tensor
A: The formula is $\vec{F} = p \vec{n} A$ where $\vec{n}$ is the unit vector perpendicular to the surface.
A: Pressure isn't a scalar: it's a matrix.
The full expression for the force-pressure-area relationship $F=pA$ reads
$$
\begin{pmatrix}F_x\\ F_y \\ F_z \end{pmatrix}
=
\begin{pmatrix}p & 0 & 0 \\  0 & p & 0 \\ 0  & 0 & p\end{pmatrix}
\begin{pmatrix}A_x\\ A_y \\ A_z \end{pmatrix},
$$
where $\vec F = (F_x, F_y, F_z)$ is the force exerted by the fluid on a given flat bit of surface, and $\vec A = (A_x, A_y, A_z)$ is the area vector of the surface: a vector whose magnitude is the area of the surface, along a direction that's normal to the surface.
Now, that looks like a horrendous way to over-complicate a formula that can be written much more succinctly, so: why am I writing it this way?
Basically, because the force-pressure-area relationship is only one simple example of the broader class of ways in which force can be transmitted through a bulk medium. If said bulk medium is isotropic, like a fluid, then the relationship boils down to the pressure, but if your bulk medium is a bit more complicated then you start getting more interesting things, like


*

*unequal pressures along different directions, so that e.g. a surface pointing along the $x$ axis will experience less pressure than a surface that points along the $y$ axis, or

*shear stresses, where a surface that points along the $x$ axis can experience a force that doesn't point in the direction of the surface normal.


Generally, however, as in the isotropic-fluid case, the force will still depend linearly on the area vector of the surface, and both of the behaviours above can be synthesized into one single matrix-vector product of the form
$$
\begin{pmatrix}F_x\\ F_y \\ F_z \end{pmatrix}
=
\begin{pmatrix}p_x & s_{xy} & s_{xz} \\  s_{yx} & p_y & s_{yz} \\ s_{zx}  & s_{zy} & p_z\end{pmatrix}
\begin{pmatrix}A_x\\ A_y \\ A_z \end{pmatrix},
$$
where the matrix is the stress tensor of the medium: its diagonal elements are 'pressures' and its off-diagonal elements denote shear stresses.
For the simple case of a fluid, the shear stresses must vanish, and the isotropy of the fluid demands that all the diagonal elements be equal, which boil down to make the stress tensor a multiple of the identity matrix. However, that simplicity can often blind you to the larger structures at play, and it is only once you find the appropriate generalization that all the mathematical structures fall into place.
A: Pressure is defined by
$$
P = |F| / A
$$
where $|F|$ is the magnitude of the normal force, thus $P$ is a scalar.
