Is friction always opposite to velocity? Let's say an object is sliding on a slope and is the object has a velocity of $(0,0,5)$. The friction would be acting in the opposite direction of motion, being $(0,0,-1)$.
However, gravity is also affecting the object on the slope. The gravity is exerting a force of $(-1,-1,0)$ in the direction of the slope tangent. Should the object also experience friction in the direction of $(1,1,0)$? Or would it only experience friction in the direction of $(0,0,-1)$?
What confuses me is that if friction is only acting in the opposite direction of motion, when an object is standing still on a slope due to friction acting in a direction opposite to gravity, when you add a perpendicular impulse the object will suddenly be sliding downwards as well because friction is no longer acting in the direction opposite to gravity. Is that correct?
 A: As pointed out in the answer by Nuclear Hoagie: there is the distinction between static friction and dynamic friction.

Here is an example of a situation where I expect a very large difference between static friction and dynamic friction.
You have a floor that is carpeted, and a piece of carpet is lying upside down on that, and the upside-down piece of carpet is pressed down by an upside down table, and it's a very heavy table.
Your task is to drag that upside-down-carpet-and-table assembly to the other side of the room. The hairs of the two carpets will tend to interlock, so it takes a lot of force to get going, but you know that once you get it going you will be able to keep it going. Once you get the two carpet sides to go out of interlocking there will still be friction, but not as much as at the start.
In most cases the difference between the static friction and the dynamics friction will be smaller than in the above example, but there will always be some difference.

So let's say an object is stationary on a slope and there is just enough static friction to keep it from sliding down the slope.
Next you give it a push to the side, making it slide sideways with respect to the slope. Now that the object is  moving the friction is dynamic friction.
Dynamic friction is less, so it may well be that now the object will slide downhill.
A: $$\underline{\textit{Qualitative analysis}}$$
It is easily observed that the contact force referred to as kinetic friction is applied by one surface on another in the direction opposite to that of the relative velocity of the latter surface.
Let us conduct the following static friction related thought experiments. These empirical thought-proofs show that this type of contact force is indeed, applied in the opposite direction of 'impending' relative velocity. Let $f$, $\mu_s$, $W$, $f\leq F$ and $\tau$ denote the relevant component of force of friction, relevant component of static friction coefficient, weight of the object and the externally applied force and torque on the body.
$\textit{Friction block thought experiment:}$ In the figure below, we know that in the static case, $f=F$ and that if $F=f\leq\mu_sW$, then the block has vanishing acceleration. Clearly, the 'impending' relative velocity of the block is in the direction of $F$ towards the right of the figure and the force of static friction is acted by the ground surface on the block surface in the opposite direction of this relative velocity.

$\textit{Rolling without slipping thought experiments:}$ In the case of the circular body rolling without slipping in the figures below, we know that the translational velocity (in the direction of $F$ or towards the right of the figure), $v$, of the center of the circle is given as $v=-\omega R$ due to the assumption of rolling without slipping, where $\omega$ is the non-vanishing $Y$ component of the rotational velocity (with the other components necessarily being vanishing due to the assumption of planar motion) and $R$ is the radius of the circle. Therefore, assuming that the center of the circle is also the center of mass (COM) of the body, we obtain the translational acceleration of the COM as $a = -\alpha R$, where $\alpha$ is the non-vanishing $Z$ component of the rotational acceleration (with the other components necessarily being vanishing due to the assumption of planar motion) of the body. Further, the analysis of the angular momentum implies that $\tau_\text{ext}=I\alpha$ where $\tau_\text{ext}$ is the externally applied torque on the body and $I$ is the moment of inertia about the axis passing through the center of the circle. Further, the rolling without slipping phenomenon implies that the relative velocity of the contact point of the circular body with respect to (w.r.t.) that of the ground surface is vanishing. In both situations depicted in the figure below, this assumption implies that $f=\mu_s W$.
In both thought experiments shown below, the rotational velocity and acceleration of the body are measured positive in the direction of a right hand screw being screwed out of the screen. The coordinate system used is $XYZ$ with the $X$ axis pointing to the right of the screen parallel to the ground surface and the $Z$ axis pointing vertically downwards. In both cases below, the COM of the body will (using our physical intuition in the thought experiment) accelerate towards the right of the page, that is, in the direction $+X$.


*

*Force driven wheel (figure on the left): The Newton's laws of motion imply that $F-f=\frac{W}{g}a=-\frac{W}{g}\alpha R$ and $-fR=I\alpha$ which implies that $0\leq a$, $\alpha\leq 0$. We observe that if the direction of the static friction force is reversed, we would obtain a contradiction since the rolling without slipping condition would be violated (because the direction of acceleration obtained would be opposite to that required in the known relationship $\vec{a}=-\vec{\alpha}\times R\hat{k}=-\alpha \hat{j} \times R\hat{k}$ to obtain the correct rightward acceleration of the COM). Notice that the direction of the 'impending' relative velocity of the point at the location of surface contact on the body (w.r.t. the ground surface) is in the direction of the applied force $F$ which points in the $+X$ direction, and that the force of friction acts opposite to this direction. Further, as an aside, notice that if the circular body is a uniformly dense cylinder of mass $m:=\frac{W}{g}$, then $I=m\frac{R^2}{2}$, so that the equations of motion yield $F=f$. The static friction condition $f\leq \mu_s W$ therefore implies that $F=3f\leq \mu_s W=3\mu_s mg$, which provides the upper bound on the driving force which allows rolling without slipping. Finally, the derived bound provides insight into the upper bound of acceleration $a=\frac{2f}{m}$ allowable under the rolling without slipping regime. In fact, this is the underlying reason why circular wheels are more efficient than non-circular ones.

*Torque driven wheel (figure on the right): The Newton's laws of motion imply that $-\tau+fR=I\alpha$ and $f=\frac{W}{g}a=-\frac{W}{g}\alpha R$, which implies  that $0\leq a$, $\alpha\leq 0$. Clearly, assuming that the direction of the friction of force is opposite to that shown in the figure will lead to a contradiction violating the rolling without slipping condition (because the direction of acceleration obtained would be opposite to that required in the known relationship $\vec{a}=-\vec{\alpha}\times R\hat{k}=-\alpha \hat{j} \times R\hat{k}$ to obtain the correct rightward acceleration of the COM). Notice that the direction of the 'impending' relative velocity of the point at the location of surface contact on the body (w.r.t. the ground surface) is in opposite to the direction of the applied force $F$, that is in the direction $-X$, and that the force of friction acts opposite to this direction. Further, as an aside, notice that if the circular body is a uniformly dense cylinder of mass $m:=\frac{W}{g}$, then $I=m\frac{R^2}{2}$, so that the equations of motion yield $\tau=-\frac{3}{2}{f}{R}$. The static friction condition $f\leq \mu_s W$ therefore implies that $\tau\leq \frac{3}{2}\mu_s WR=\frac{3}{2}\mu_s mgR$, which provides the upper bound on the driving torque which allows rolling without slipping. Finally, the derived bound provides insight into the upper bound of acceleration $a=\frac{f}{m}$ allowable under the rolling without slipping regime.


$$\underline{\textit{Conclusions}}$$

*

*The contact force referred to as kinetic friction is applied by one surface on another in the direction opposite to that of the relative velocity of the latter surface w.r.t. the former surface.

*The contact force referred to as static friction is applied by one surface on another in the direction opposite to that of the 'impending' relative velocity of the latter surface. The direction of the impending velocity, which is a fictitious quantity, is in the direction of the relative acceleration (w.r.t. the surface applying the force) of the point of contact resulting from the dynamics in which the friction force of interest is fictitiously assumed to be vanished w.r.t. the former surface.

A: Kinetic friction always acts opposite to relative motion, while static friction acts opposite to the tendency of motion. Kinetic friction is a dissipative force that turns kinetic energy into non-useful waste heat. If kinetic friction could act in the same direction as relative motion, that would imply that friction could increase the magnitude of an object's velocity relative to the surface, imparting useful kinetic energy from somewhere. But kinetic friction only turns movement into heat, it cannot turn heat back into motion. Friction can never make an object move faster, only slower - it always acts opposite to relative velocity.
A: A better phrasing is:

Friction always pulls in the direction that prevents sliding (often called relative motion).

Remember, there are two types of friction:

*

*Kinetic friction when the object slides. To prevent sliding (to stop sliding), kinetic friction pulls exactly opposite to the velocity. Regardless of any forces acting.


*Static friction when the object is stationary but there are forces trying to make it slide. To prevent sliding (to keep the object stationary), static friction pulls opposite to whichever direction the net force pulls.
Gravity is an external force. When standing still on flat ground, gravity doesn't try to initiate sliding, so there is no need for a static friction to act opposite to gravity. When standing on a slope, a component of gravity pulls along with this slope and tries to start sliding down - static friction thus must pull opposite to this, so up the slope. But not if I at the same time push on the object up along the slope - then static friction might have to pull downwards to prevent the object from sliding upwards.
So static friction is not related to gravity in general. Gravity is just one possible force to hold back against. There is no requirement for frictions to act opposite to gravity.
