Calculating the unknown charge using the \$2\$ remaining charges in this arrangement
Is it true when the top charge is negative then the direction of f will be horizontal from right to left? If so, please tell me why this could be proven

Well, trying out the math behind is interesting, and can explain. This is the setup of charges as per the question (pardon my drawing skills):

Where -
$$Q_1= 5\times 10^3C$$
$$Q_2= -5\times 10^3C$$
\$\overrightarrow {F_{AC}}\$ is assumed to be the force exerted by \$Q_1\$ on \$Q_3\$ in the direction AC.
\$\overrightarrow {F_{BC}}\$ is assumed to be the force exerted by \$Q_2\$ on \$Q_3\$ in the direction BC.
Mathematically, the net force exerted on \$Q_3\$ is -
$$\mathbf{\overrightarrow F=\overrightarrow {F_{AC}} + \overrightarrow {F_{BC}}}\tag{1}$$
We can use vector resolution to represent \$\overrightarrow {F_{AC}} \$ and \$\overrightarrow {F_{BC}} \$ -
$$\overrightarrow {F_{AC}}=  {F_{AC}}.cos\alpha .\hat i+{F_{AC}}.sin\alpha .\hat j$$
$$\overrightarrow {F_{BC}}=  {F_{BC}}.cos(180-\beta) .\hat i+{F_{BC}}.sin(180-\beta) .\hat j$$
Note that the triangle is isosceles triangle, because \$AC=BC\$, hence \$\alpha=\beta\$
So the expressions for \$\overrightarrow {F_{AC}} \$ and \$\overrightarrow {F_{BC}} \$ now become -
$$\overrightarrow {F_{AC}}=  {F_{AC}}.cos\alpha .\hat i+{F_{AC}}.sin\alpha .\hat j$$
$$\overrightarrow {F_{BC}}=  {F_{BC}}.cos(180-\alpha) .\hat i+{F_{BC}}.sin(180-\alpha) .\hat j$$
$$\implies$$
$$\mathbf{\overrightarrow {F_{AC}}=  {F_{AC}}.cos\alpha .\hat i+{F_{AC}}.sin\alpha .\hat j}$$
$$\mathbf{\overrightarrow {F_{BC}}=  -{F_{BC}}.cos\alpha .\hat i+{F_{BC}}.sin\alpha .\hat j}$$
Equation (1) therefore becomes -
$$\mathbf{\overrightarrow F=({F_{AC}}.cos\alpha .\hat i+{F_{AC}}.sin\alpha .\hat j) + (-{F_{BC}}.cos\alpha .\hat i+{F_{BC}}.sin\alpha .\hat j)}$$
$$\implies \mathbf{\overrightarrow F=({F_{AC}-F_{BC})}.cos\alpha .\hat i + (F_{AC}+F_{BC}).sin\alpha .\hat j} \tag{2}$$
Let us apply Coulomb's law to find the magnitude of forces \$F_{AC}\$ and \$F_{BC}\$.
$$F_{AC}=k.\frac{Q_1Q_3}{r_{AC}^2}$$
$$F_{BC}=k.\frac{Q_2Q_3}{r_{BC}^2}$$
since \$r_{AC}=r_{BC}\$ and \$Q_1=-Q_2\$, Let us write -
$$F_{AC}=k.\frac{Q_1Q_3}{r^2}$$
$$F_{BC}=-k.\frac{Q_1Q_3}{r^2}$$
Therefore Equation (2) becomes -
$$\bbox[8px,border:1px solid black]{\mathbf{\overrightarrow F=2k.\frac{Q_1Q_3}{r^2}.cos\alpha.\hat i}}\tag{3}$$
The observations from the equation of \$\overrightarrow F\$ are -

The horizontal component of the net force on \$Q_3\$is non-zero while the vertical component is zero. i.e., only horizontal force is experienced by \$Q_3\$ in this arrangement of charges.
The net force experienced by \$ Q_3 \$is,  \$\bbox[8px,border:1px solid black]{F=2k.\frac{Q_1Q_3}{r^2}.cos\alpha}\$. \$Q_1\$ is positive therefore, the direction of this horizontal force depends upon the sign of the charge \$Q_3\$. If -ve, then it will be 'right to left (-ve x-axis)', otherwise 'left to right(+ve x-axis)'


\$F=8.0∗10^5N\$ (force which is created from the 3 charges at the top charge. The direction of it is horizontal from left to right). Firstly the official answer says that the top charge is a positive charge since f is horizontal from left to right.

Hope this is clear now from the math expression for \$F\$ we just derived.